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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
batmit25
Frequent Visitor

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:-

 

Retained Customers = 
SUMX(VALUES(Superstore[Customer ID]),
                                    IF(NOT(ISBLANK([Sales LM]))&&NOT(ISBLANK([Sales TM])),1,BLANK()))
Lost Customers = 
SUMX(VALUES(Superstore[Customer ID]),
                                   IF(ISBLANK([Sales LM])&&NOT(ISBLANK([Sales TM])),1,BLANK()))
 
For added context:-
Sales LM(Last Month) =
calculate([Total Sales],DATESMTD(DATEADD('Date Table'[Date],-1,MONTH)))
Sales TM(This Month) =
CALCULATE([Total Sales],DATESMTD('Date Table'[Date]))
 
Retained and Lost Customers ResultRetained and Lost Customers Result-Measure Used-Measure Used
 
However while doing Lost Customers, I dont get the result that I want. The values that should be shown as 1 in each row return as blank. 
 
Customers Lost = 
SUMX(VALUES(Superstore[Customer ID]),
            IF(NOT(ISBLANK([Sales LM]))&&ISBLANK([Sales TM]),1,BLANK()))
 
-Blank returned for lost customers-Blank returned for lost customers-Dax used for Lost Customers-Dax used for Lost Customers

 

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.

1 ACCEPTED SOLUTION

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.

View solution in original post

13 REPLIES 13
batmit25
Frequent Visitor

Hi @v-junyant-msft ,

 

Let me know if this helps or if I need to add anything more.Customer Churn - Error with Lost Customers 

Hi @batmit25 ,
I used the measure you created earlier, and everything works fine...

vjunyantmsft_0-1699404487712.png

I'm a little confused, maybe you have a problem with your previous operation? Please try again.

Hi @v-junyant-msft , 

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 SelectionWith Slicer SelectionWithout Slicer SelectionWithout Slicer SelectionWith Filter FunctionWith Filter Function

 

Hi @batmit25 
I also tested it on a few of my colleagues' computers, and they all showed up fine. This is indeed a strange thing...
Let me do more testing to try and figure out what the problem is.

Hi @v-junyant-msft , 

Sure thing, Let me know if there's anything to be added from my side and Thank you again for the commitment and help!

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.

v-junyant-msft
Community Support
Community Support

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:

vjunyantmsft_0-1699254975036.png

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.

 

 

Hi @v-junyant-msft ,

 

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 :))

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:

vjunyantmsft_2-1699258876342.png

 

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:

vjunyantmsft_1-1699258603927.png

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.

 

 

Hi @v-junyant-msft,

The DAX measures work perfectly for Retained and New Customers, However while trying to aggregate the Lost Customers value. I run into the same problem of everything being blank.

I'm not sure whether it's related to how I modeled my data but if need be I can share my report(Just a trial report). Let me know if there's anything I can add to solve this issue. 

 

Thanks again much appreciated!

Hi, @batmit25 
Yes, you can share your report with me, but please note that before you share it, please check if it contains any private information (such as account number and password, etc.), and if so, please delete it before sharing.

batmit25
Frequent 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 IDSales Last MonthSales This Month
A-1232325
B-12312 
C-123 45
D-12335 
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 MonthSales This MonthLost Customer
A-1232325 
B-12312 1
C-123 45 
D-12335 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!

speedramps
Super User
Super 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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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