Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello everyone,
I’m having trouble visualising a list of churned customers. I have made a measurement that calculates the churn rate of customer's. I have done this with the following 2 columns in my data model:
Example:
Boekjaar | Klantnaam |
2022 | Customer 1 |
2022 | Customer 2 |
2023 | Customer 1 |
2023 | Customer 3 |
2023 | Customer 1 |
2022 | Customer 4 |
2022 | Customer 4 |
2022 | Customer 2 |
My measurement to calculate the churnrate works very well. It goes as follows:
What I am expecting are results like:
ChurnedCustomers |
Customer 2 |
Customer 4 |
(These are the customers that had an invoice in 2022, but none in 2023, and thus have left our service.)
Thank you in advance for reading and thinking with me 🙂
Hi @Selina
You can try the following code
If_exist =
VAR CCurrentYear =
MAX ( 'Gefactureerde omzet'[Boekjaar] )
VAR CPreviousYear = CCurrentYear - 1
VAR CurrentYearCustomers =
CALCULATETABLE (
VALUES ( 'Gefactureerde omzet'[Klantnaam] ),
'Gefactureerde omzet'[Boekjaar] = CCurrentYear
)
VAR PreviousYearCustomers =
CALCULATETABLE (
VALUES ( 'Gefactureerde omzet'[Klantnaam] ),
'Gefactureerde omzet'[Boekjaar] = CPreviousYear
)
VAR ChurnedCustomers =
EXCEPT ( PreviousYearCustomers, CurrentYearCustomers )
RETURN
IF (
SELECTEDVALUE ( 'Gefactureerde omzet'[Klantnaam] ) IN ChurnedCustomers,
1,
0
)
Then put the measure to the table visual filter
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello Yolo,
Thank you for your response! I think it's very smart to do it this way. However it seems
RETURN IF ( SELECTEDVALUE ( 'Gefactureerde omzet'[Klantnaam] ) IN ChurnedCustomers, 1, 0 )
returns a 0 for every customer. Any idea why?
Hi @Selina
Or you can try the following solution.
If_exist_counts =
VAR CCurrentYear =
MAX ( 'Gefactureerde omzet'[Boekjaar] )
VAR CPreviousYear = CCurrentYear - 1
VAR CurrentYearCustomers =
CALCULATETABLE (
VALUES ( 'Gefactureerde omzet'[Klantnaam] ),
'Gefactureerde omzet'[Boekjaar] = CCurrentYear
)
VAR PreviousYearCustomers =
CALCULATETABLE (
VALUES ( 'Gefactureerde omzet'[Klantnaam] ),
'Gefactureerde omzet'[Boekjaar] = CPreviousYear
)
VAR ChurnedCustomers =
EXCEPT ( PreviousYearCustomers, CurrentYearCustomers )
RETURN
COUNTROWS ( ChurnedCustomers )
Then put the If_exist_counts measure to the visual filter, set it greater than 0
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @v-xinruzhu-msft ,
Thank you for your fast response. Maybe I am understanding you wrong. I made a new measurement and copied your code for If_exist_counts. Next I made a table with that lists all
Gefactureerde omzet'[Klantnaam]
, and put a filter on it with measurement "If_exist_counts" and set it to greater then 0. However, it shows none (all empty) as I would expect. Because your new measurement counts the amount of churned customers. For example, with my current data it gives the value 242. So that still doesn't tell which of those customers are churned. I feel we were on the right path with your 1st solution. However every customer's value was set to 0.