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
shyammayhs
Advocate II
Advocate II

Loyal Vs Risk Customers

Hi guys,

 

I would like to to see the DISTINCTCOUNT of Customers that have purchased in the last 3-12 months and also that havent purchased in the last 2months. I have thought about Virtual tables/CALCULATEDTABLE etc, but nothing is working for me at the moment!

 

Has anyone come across a problem like this before?

 

Thanks guys!

5 REPLIES 5
v-luwang-msft
Community Support
Community Support

Hi @shyammayhs ,

Could you pls share your  data model.You could attach your pbix on a public link.And remember remove confidential data.

 

 

Best Regards

Lucien

AllisonKennedy
Super User
Super User

@shyammayhs 

 

Here is a measure I have used for this: 

 

Inactive Customer Count =
VAR _InactiveDate = MIN('Inactive Date Range'[Date])
COUNTROWS(FILTER('DimCustomer', [Sales]>0 && 'DimCustomer'[Last Transaction Date]< _InactiveDate ))
 
Note it uses an unrelated table for _InactiveDate so that you can adjust how you define 'active', rather than hard coding it into the measure (these are some of the questions @PaulDBrown is asking you to answer).  That Inactive Date Range table just needs a Date column, or anything else you'd want to use in the filters: 
 
AllisonKennedy_0-1634593967254.png

 

In the screenshot above, the date filter on left is my DimDate table, and on the right is the Inactive Date Range table.

 

I have a visual level filter on the Inactive Date Range filter using this measure, so that you can't pick a date before the DimDate selection: 

Inactive Date Filter = COUNTROWS(FILTER('Inactive Date Range','Inactive Date Range'[Date] >= MIN('Calendar'[Date]) ))
 
Hope that helps!

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

PaulDBrown
Community Champion
Community Champion

Please provide sample data or PBIX file. Thanks!





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi @PaulDBrown, The data I am using is sensitive. But I will try to come up with a mock up. I am assuming you haven't encountered a scenario like this before!

 

Thanks

It's a variation of the "new (and/or lost) customers" calculation. Yet it's much more productive to work on an actual model than to imagine tables/relationships/measures. So a mock up would be really helpful.

Also please clarify what "in the last 3-12 months" means (customers who made purchases within Today - 3 months to Today-12 months?

A depiction of how you wish to present these calculations is also needed.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






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.