Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello everyone,
I hope you're all doing well. I'm currently working on a project and could use some guidance regarding a DAX measure. I'm trying to calculate distinct counts for different types of customers on a monthly basis, and I'm encountering a few challenges.
Specifically, I'm aiming to determine the following metrics using DAX measures:
The database has been loaded into Power Query, and I've successfully established connections in Power Pivot.
Additionally, I'm hoping to enhance this analysis by segmenting the results based on categories and brands, if possible.
If any of you have experience with DAX measures and are willing to lend a helping hand, I would greatly appreciate it. Your expertise could make a significant difference in advancing this project.
Thank you in advance for your support. Looking forward to your insights!
Best regards, Santosh
Sample database table for reference.
date | customer id |
01 January 2022 | cust-001 |
02 January 2022 | cust-002 |
03 January 2022 | cust-003 |
01 January 2022 | cust-001 |
01 February 2022 | cust-001 |
02 February 2022 | cust-002 |
03 February 2022 | cust-004 |
02 February 2022 | cust-002 |
01 March 2022 | cust-001 |
01 March 2022 | cust-002 |
01 March 2022 | cust-005 |
01 March 2022 | cust-002 |
Thank you so very much for providing me the dax. It works fine on date level when it is being analysed on month level in pivot table the result reflects as zero. Kindly have a look once more. Thanks! once again.
Try adding REMOVEFILTERS('Date') into the CALCULATETABLE calls.
You could create measures like
Lost Customers =
VAR CurrentCustomers =
DISTINCT ( 'Table'[customer id] )
VAR PrevCustomers =
CALCULATETABLE (
DISTINCT ( 'Table'[customer id] ),
DATEADD ( 'Date'[Date], -1, MONTH )
)
VAR Result =
COUNTROWS ( EXCEPT ( PrevCustomers, CurrentCustomers ) )
RETURN
Result
New Customers =
VAR CurrentCustomers =
DISTINCT ( 'Table'[customer id] )
VAR PrevCustomers =
CALCULATETABLE (
DISTINCT ( 'Table'[customer id] ),
DATEADD ( 'Date'[Date], -1, MONTH )
)
VAR Result =
COUNTROWS ( EXCEPT ( CurrentCustomers, PrevCustomers ) )
RETURN
Result
Repeat Customers =
VAR CurrentCustomers =
DISTINCT ( 'Table'[customer id] )
VAR PrevCustomers =
CALCULATETABLE (
DISTINCT ( 'Table'[customer id] ),
DATEADD ( 'Date'[Date], -1, MONTH )
)
VAR Result =
COUNTROWS ( INTERSECT ( CurrentCustomers, PrevCustomers ) )
RETURN
Result
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
6 | |
3 | |
3 | |
3 |
User | Count |
---|---|
13 | |
11 | |
8 | |
8 | |
8 |