Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Laila92
Helper V
Helper V

Check if all rows for a certain customer are marked as "churned"

I have a dataset where one customer can have multiple products. He can be live on certain products, but churned on other products.
He will only be marked as a churned customer if he is churned from all products. 
How can I loop through the product status of each customer with DAX, checking if all of the statuses are lost, and then counting these up so I have the number of churned customers?
Example data:
Customer ID   Product ID    Status

1                      1                   Live

1                      2                   Lost
2                      1                   Lost

2                      2                   Lost

3                      1                   Live

3                      2                   Lost

 

The count I would want for the dataset above is 1, for customer 2. The other ones have Live deals so are not churned.

I tried using COUNTX/COUNTAX but to no avail, for example:

Churned Customers = COUNTX( FILTER('Deal Status','Deal Status'[Deal - Status] = "Lost"),'Deal Status'[Deal - Status])
1 ACCEPTED SOLUTION
Anonymous
Not applicable

This will be formula as per your data set.
 
ChurnedCustomer =
VAr Live_count=CALCULATE(DISTINCTCOUNT(Sheet1[Customer ID]),FILTER(Sheet1,Sheet1[Status]="Live"))
Var Total=DISTINCTCOUNT(Sheet1[Customer ID])
return
Total-Live_count
 
Regards,
Pravin Wattamwar
 

View solution in original post

6 REPLIES 6
Greg_Deckler
Super User
Super User

Try this:

 

Measure = 
    VAR __Table = SUMMARIZE('Table9',[Customer ID],"TotalCount",COUNTX('Table9',[Product ID]),"LostCount",COUNTX(FILTER('Table9',[Status]="Lost"),[Product ID]))
RETURN
    COUNTROWS(FILTER(__Table,[TotalCount] = [LostCount]))

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

 
Hi @Laila92 
Try this measure,
churned.PNG
 
ChurnedCustomer =
VAr Live_count=CALCULATE(DISTINCTCOUNT(Sheet1[Prod ID]),FILTER(Sheet1,Sheet1[Status]="Live"))
Var Total=DISTINCTCOUNT(Sheet1[Prod ID])
return
Total-Live_count
 
If i solve your problem mark it as solution and give kudoes.
 
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

Your formula calculates the churns on deal level, not on customer level. I need the total count of customers for whom all deals are marked as churn. 

Anonymous
Not applicable

its on customer level only.

In my data set i have taken customer as product ID and prod id as ID. Just rename the columns.

 

Thanks,

Pravin Wattamwar

Anonymous
Not applicable

This will be formula as per your data set.
 
ChurnedCustomer =
VAr Live_count=CALCULATE(DISTINCTCOUNT(Sheet1[Customer ID]),FILTER(Sheet1,Sheet1[Status]="Live"))
Var Total=DISTINCTCOUNT(Sheet1[Customer ID])
return
Total-Live_count
 
Regards,
Pravin Wattamwar
 

Thank you, but this is not giving me back entirely what I need. This formula returns a count also when a client has churned on one product, but is live on another. How can I filter out the clients that do have a churn on one product but are live on another?
Example of the data where it goes wrong:

Product ID           Client          Lost Date             Deal status
1                           1                 August 23,2018   Churned
2                           1                                             Live
3                           1                                             Live

This should not give me back a count as churned customer, but it did.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors