OpenBI Docs Buy

SURVIVAL.AT OpenBI

A Kaplan-Meier curve's value at a time, for a sentence or a card.

Group: Survival analysis. OpenBI’s own: DAX has no function of this name.

Syntax

SURVIVAL.AT ( <table>, <duration>, <event>, <time> )
ParameterTypeDescription
tableTableThe rows to follow, one a subject such as a customer, a policy or a machine: a table of the model or a table expression, as the filters leave it.
durationNumber
evaluated for each row
How long each row was followed: until its event, or until we stopped seeing it. In any unit (days, months, years), the same for every row.
eventNumber
evaluated for each row
1 or TRUE when the row's duration ended in the event (the customer left); 0 or FALSE when it did not, so all we know is that it lasted at least that long (censored).
timeNumberThe time to read the curve at.

Returns

Number. The Kaplan-Meier survival at that time: the share still without the event.

Remarks

  • It is the Survival of SURVIVAL.CURVE at the last time at or before the one given: events at that very time count. Before the first event it is 1.
  • One value, for a card or a sentence: "78 % of customers stay a year". For a group, filter the table: SURVIVAL.AT ( FILTER ( Customers, [Plan] = "Plus" ), [Months], [Left], 12 ).
  • Rows with a blank duration or a blank event are left out. An event other than 0, 1, TRUE or FALSE is an error.

Compared with DAX

An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.

Examples

The curve at a few times

EVALUATE
VAR Customers =
    DATATABLE (
        "Plan", STRING, "Months", INTEGER, "Left", INTEGER,
        {
            { "Basic", 2, 1 }, { "Basic", 3, 0 }, { "Basic", 5, 1 }, { "Basic", 7, 1 }, { "Basic", 8, 0 },
            { "Plus", 4, 1 }, { "Plus", 9, 0 }, { "Plus", 11, 1 }, { "Plus", 12, 1 }, { "Plus", 15, 0 }
        }
    )
RETURN
    ROW (
        "At 0", SURVIVAL.AT ( Customers, [Months], [Left], 0 ),
        "At 6", SURVIVAL.AT ( Customers, [Months], [Left], 6 ),
        "At 11", SURVIVAL.AT ( Customers, [Months], [Left], 11 ),
        "At 100", SURVIVAL.AT ( Customers, [Months], [Left], 100 )
    )
At 0At 6At 11At 100
10.6750.3750.1875

Half a year, by plan

EVALUATE
VAR Customers =
    DATATABLE (
        "Plan", STRING, "Months", INTEGER, "Left", INTEGER,
        {
            { "Basic", 2, 1 }, { "Basic", 3, 0 }, { "Basic", 5, 1 }, { "Basic", 7, 1 }, { "Basic", 8, 0 },
            { "Plus", 4, 1 }, { "Plus", 9, 0 }, { "Plus", 11, 1 }, { "Plus", 12, 1 }, { "Plus", 15, 0 }
        }
    )
RETURN
    ROW (
        "Basic", SURVIVAL.AT ( FILTER ( Customers, [Plan] = "Basic" ), [Months], [Left], 6 ),
        "Plus", SURVIVAL.AT ( FILTER ( Customers, [Plan] = "Plus" ), [Months], [Left], 6 )
    )
BasicPlus
0.5333333333333330.8

SURVIVAL.MEDIAN, SURVIVAL.CURVE, SURVIVAL.SUMMARY.

Last updated · OpenBI Studio 0.3.74