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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
PowerBI_User_XV
New Member

Calculate cumulative distinct count of member by different stages

Hi community, I have three table with members with different status and the date when they reach that status, each table represent a status. I have a Calendar table related to each tabla date column. Each table has one row by member. I want to calculate cumulative distinct count of members by months, for three combinations: those on Stage1, those on Stage1 and Stage2, those on Stage1 and Stage2 and Stage3. This is my sample table:

Stage1

IdStage1_Date
mbr101/20/2025
mbr201/15/2025
mbr302/04/2025
mbr4

03/25/2025

mbr5

03/16/2025

mbr6

05/20/2025

 

Stage2

IdStage2_Date
mbr103/20/2025
mbr201/18/2025
mbr302/15/2025
mbr4

04/25/2025

mbr5

05/20/2025

mbr6

05/26/2025

 

And a similar table for Stage3.

 

The expected output is:

StageJanFebMarAprMay
Stage123556
Stage1 + Stage212346
Stage1 + Stage2 +Stage 3xxxxx

 

I have achieved the first output line, that's a ease one. I have try different dax formulas that seem work, however when I validate the numbers are not right.

 

This is one of the formulas I have tried for the last output row:

 

Stage1 + Stage2 +Stage 3 :=

VAR CurrentMonthEndDate = MAX ( 'Calendar'[Date] )

VAR Stage1_Table = SELECTCOLUMNS(ALL(Stage1), "MBR_ID",[Id])

VAR Stage2_Table = SELECTCOLUMNS(ALL(Stage2), "MBR_ID",[Id])

RETURN

CALCULATE (

DISTINCTCOUNT ( Stage3[Id] ),

FILTER (

ALL ( 'Calendar' ),

'Calendar'[Date] <= CurrentMonthEndDate

),

Stage3[Id] IN Stage1_Table &&

Stage3[Id] IN Stage2_Table 

)

 

I appreciate any help!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1758770029772.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1758770029772.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @PowerBI_User_XV   ,
Thanks for reaching out to the Microsoft fabric community forum. 

I would also take a moment to thank @Ashish_Mathur , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.

Best Regards, 
Community Support Team.

 

Hello @PowerBI_User_XV  ,

 

I am also part of CST Team and we’d like to confirm whether your issue has been successfully resolved. If you still have any questions or need further assistance, please don’t hesitate to reach out. We’re more than happy to continue supporting you.

 

Regards,

B Manikanteswara Reddy

Hi @msprog   ,
Thanks for reaching out to the Microsoft fabric community forum. 

 

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.

Best Regards, 
Community Support Team.

GeraldGEmerick
Continued Contributor
Continued Contributor

@PowerBI_User_XV Seems like it would be easier to do it this way:

Distinct Count =
VAR _Table = UNION( 'Stage1', 'Stage2', 'Stage3' )
VAR _Return = DISTINCTCOUNT( SELECTCOLUMNS( _Table, "Id", [Id] ) )
RETURN _Return

Thank you for your answer, but what about the dates? The idea is, for the output second row, distint count of members that had a January date in both table Stage1 and Stage2, same for Feb ... an so on. For the third output row, I need how many had Stage1 in January, Stage2 in Jabuary and Stage3 in January ... and so on for each month.  

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors