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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

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
Community Champion
Community Champion

@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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.