Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
I’m trying to create a measure that tracks how many of our customers are still with us after X number of days.
Currently I use this formula:
Survival Curve =
1- (divide( CALCULATE(
SUM('Attrition Query'[Churn]),
FILTER(
ALLSELECTED('Attrition Query'[Current Day]),
ISONORAFTER('Attrition Query'[Current Day], MAX('Attrition Query'[Current Day]), DESC)
)
),CALCULATE(
COUNT('Attrition Query'[BSCustomerID]),
ALLSELECTED('Attrition Query'[Current Day]))))
This takes the running total of all customers who leave us by the day they do.
[Current Day] is a calculated column which returns either the day of their contract they left us or, if they haven’t left us, the datediff between their start day and today.
Current Day = if('Attrition Query'[StillFlowing]=0, if('Attrition Query'[FLOW_END_DATE]>today(),datediff('Attrition Query'[FLOW_START_DATE], Today(), DAY),DATEDIFF('Attrition Query'[FLOW_START_DATE], 'Attrition Query'[FLOW_END_DATE], DAY)), datediff('Attrition Query'[FLOW_START_DATE], Today(), DAY))
However, I run into one main issue stemming from the fact that I have a variety of customers starting at different time periods, so they are all counted in the denominator. The formula currently says that my 1-year survival is 72%, however that is far too high as the real number is 56.4%. The issue is that customers who have not yet been with us a year are being factored into the denominator, even though they could conceivably leave before they get to a year.
What I would like to do is exclude any customers from the measure when their DateDifference: DateDifference = DATEDIFF('Attrition Query'[FLOW_START_DATE], today(), DAY)
is less than the Current Day in the measure. So if we were looking at an X axis, the higher we go on the X axis, the smaller the Denominator gets.
Any help would be greatly appreciated, thanks!
Hi, @NewAnalyst16 ;
You could modify Survival Curve measure as follows:
Survival Curve =
1
- (
DIVIDE (
CALCULATE (
SUM ( 'Attrition Query'[Churn] ),
FILTER (
ALLSELECTED ( 'Attrition Query'[Current Day] ),
ISONORAFTER (
'Attrition Query'[Current Day], MAX ( 'Attrition Query'[Current Day] ), DESC
)
),
FILTER (
ALLSELECTED ( 'Attrition Query'[Current Day] ),
'Attrition Query'[FLOW_END_DATE] <= TODAY ()
)
),
CALCULATE (
COUNT ( 'Attrition Query'[BSCustomerID] ),
ALLSELECTED ( 'Attrition Query'[Current Day] )
)
)
)
Here I have added an additional filter condition, which may be consistent with the idea of DateDifferences less than the Current Day, you could try it.
If it not right, please provide me with more details about your table or share me with your pbix file after removing sensitive data.
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ideally I would like to use that filter you added, but more like:
Thanks for responding and sorry for the late reply. When I add the additional filter, I get an error that "A single value for column 'FLOW_END_DATE' cannot be determined". It says this is because there is no aggregation in the formula.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
85 | |
70 | |
68 | |
51 | |
32 |
User | Count |
---|---|
115 | |
100 | |
74 | |
65 | |
40 |