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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

DAX to find Count Distinct of Row Lesser Than Certain Number

So I have a table as follows:

 

CustomersDays Since PurchasedOther Columns
Anya123-
Bob223-
Caroline6000-
Dally5732-
Anya 4511 

 

I want to find the COUNT of CUSTOMERS who have purchased within the ast 2000 days (and in this table see, for example Anya has purchased reently as wel as several days earlier, we would like to keep only Anya's recent purchase and hence the  COUNT should return 2 (since Dally and Caroline  have purchased > 2000 days before).

 

Sample Data: Download Excel File 

 

Thanks!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a measure like

countx(filter(summarize(Table, Table[Customers], "_1", min(Table[Days Since Purchased])),[_1]>2000),[Customers])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@amitchandak 

 

Please stop using SUMMARIZE for anything else but grouping and do not recommend it to others, especially those that are not very familiar with the quirks of DAX. This function is "broken" and there are much better alternatives. If you want to know why, please read this: https://www.sqlbi.com/articles/all-the-secrets-of-summarize/

 

Thanks.

amitchandak
Super User
Super User

@Anonymous , Try a measure like

countx(filter(summarize(Table, Table[Customers], "_1", min(Table[Days Since Purchased])),[_1]>2000),[Customers])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors