Forum Discussion
VALUES() returning blank - Customer Churn
Hi everyone,
I'm trying to work on a Customer Churn Report and as a beginning step I need to classify customers as New,Retained and Lost for every month selected via a slicer. The logic here is to find if a customer has made a sale in the previous and current month and then to classify them as retained, lost, new for the current selected month.
I'm successful in getting the DAX and wanted result right for Retained Customers and Lost Customers, they're as follows:-
I'm not sure as to why that measure returns blank, I've tried to use ALL, DISTINCT functions and they don't quite do the job.
- Anonymous2 years ago
Hi batmit25 ,
I thought of a possibility that could cause me to run fine but you can't show it. I'm using the latest version of Desktop, but when I open the pbix file you provided, it says that you are using an older version of Desktop, I suspect it's because of the version, you can try to use the newer version of Desktop and try again.Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
13 Replies
- speedrampsSuper User
We want to help you but your description is too vaugue. Please write it again clearly.
Please ask 1 question per ticket. Not 3 (new, lept and lost customers).Please DON'T copy & paste your reports that does not work and expect us to fathom what you want to do. That is a bit crazy. 😀
Please just give a simple non technical functional decscription of what you want, then let us suggest the solution. Thank you.Provide example input data as table text (not a screen print) so we can import the data to build a solution for you.
Also provide the example desired output, with a clear description of the process flow.
Remember not to share private data ... we don't want you to get into trouble. 😧
Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
Try keep it simple and ask one question per ticket.
You will get a quick response if you put time, care and effort into writing clear problem descriptions.Vaugue descriptions can waste your time and ourtime.
Look foward to helping you when the above information is forthcoming
- batmit25Frequent Visitor
I apologize, that's my first community post, I'll try to be more precise as I go. My question was as how to classify customers of a store as lost customers(The logic being if a customer made a purchase last month and dint make a purchase this month, Then they'd be a lost customer) with DAX.
Customer ID Sales Last Month Sales This Month A-123 23 25 B-123 12 C-123 45 D-123 35 E-123 23 Sales This Month = CALCUALTE([Sales],DATESMTD[Date Table])
Sales Last Month = CALCULATE([Sales],DATESMTD(DATEADD([Date Table],-1,MONTH))
The following is the result I need,
Customer ID Sales Last Month Sales This Month Lost Customer A-123 23 25 B-123 12 1 C-123 45 D-123 35 1 E-123 23 I hope this was a bit more clear and concise, if not let me know how I could make the question more clear 😅.
I apologize again for the vague question; I tried to add as much context as I could as I'm a Novice at Power Bi. Thank you for the help!
- AnonymousNot applicable
Hi batmit25 ,
You can use the following DAX to create a new column:Lost Customers = IF(NOT ISBLANK([Sales Last Month]) && ISBLANK([Sales This Month]), 1, BLANK())New Customers = IF(ISBLANK([Sales Last Month]) && NOT ISBLANK([Sales This Month]), 1, BLANK())Retained Customers = IF(NOT ISBLANK([Sales Last Month]) && NOT ISBLANK([Sales This Month]), 1, BLANK())And the final output is shown in the following figure:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- batmit25Frequent Visitor
Hi Anonymous ,
The IF conditions are right I believe!
Could I also know how you were able aggregate the Measures in order to show Total Customers(Lost,New,Retained). I used SUMX alongside but the values returned were blank.
Thank you again :))
- AnonymousNot applicable
Hi batmit25 ,
The total of the previously provided solution is not calculated by DAX, but by the built-in calculation function of Power BI Desktop:And if you want to calculate the total by DAX, you can try the following DAX to create a new measure:
Total Lost Customers = COUNTROWS(FILTER('Table','Table'[Lost Customers] = 1))Or you can use this DAX as following:
Total New Customers = SUMX(FILTER('Table','Table'[New Customers] = 1),'Table'[New Customers])And the final output is shown in the following figure:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- batmit25Frequent Visitor
Hi Anonymous ,
Let me know if this helps or if I need to add anything more.Customer Churn - Error with Lost Customers
- AnonymousNot applicable
Hi batmit25 ,
I used the measure you created earlier, and everything works fine...I'm a little confused, maybe you have a problem with your previous operation? Please try again.
- batmit25Frequent Visitor
Hi Anonymous ,
That's really strange because in the below screenshots, I've applied the same DAX functions with and without slicer selecttion and also the same measure that you've recommended. Could it be an underlying setting in my Power BI Desktop that I need to turn on/off in order to see the results that you're able to see?
With Slicer SelectionWithout Slicer SelectionWith Filter Function