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
PowerBIzNess
Frequent Visitor

Cumulative Distinct Count by Month

Hello, 

 

This is driving me crazy and is probably something simple that I'm overlooking..

 

Trying to create a calculated column that counts the distinct # of employees to date. 

 

         Curent Count        Cumulative Count

Jan - 2 Employees          2

Feb - 2 Employees         4

Mar - 2 Employees        6

 

For some reason the cumulative numbers aren't working out. 

 

Calculated Formula: 

 

Cumulative = 
CALCULATE (
DISTINCTCOUNT( [Employee] ),
FILTER (
ALL('YTD Attrition'),
[Term Date] <= MAX ( [Term Date] )
)
)

 

Here's what it looks like:

 

Capture.PNG

 

Thanks in advance!

8 REPLIES 8
v-yuezhe-msft
Employee
Employee

@PowerBIzNess,

You can download my PBIX file to test.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yuezhe-msft
Employee
Employee

@PowerBIzNess,

You can use the following DAX to calculate cumulative. Make sure that  you choose "Don't summarize" for cumulative column in table visual.

Cumulative = CALCULATE(DISTINCTCOUNT('YTD Attrition'[Employee]),ALL('YTD Attrition'),'YTD Attrition'[Term Date]<=EARLIER('YTD Attrition'[Term Date]))

1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yuezhe-msft

 

thanks so much for the reply. I realized my issue was the summarization in the visual, which displayed correctly when I selected 'Average'. For some reason the 'Don't Summarize' option doesn't appear as an option - I think this is because in order to gather some additional metrics I unpivoted a list of columns detailing attrition reasons, which created multiple rows for the same individuals. So for example my data looks like:

 

John Doe    5/1/2017   Compensation

John Doe    5/1/2017   Relocation

John Doe    5/1/2017   Benefits

 

Any suggestions you have on improving this would be appreciated!

 

@PowerBIzNess

The DAX also works in your scenario, please check the following screenshot.
1.JPG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Lydia

 

What is your default summarization for the column? I don't have a 'Don't Summarize' option so I'm left having to average the numbers.

Zubair_Muhammad
Community Champion
Community Champion

Hi @PowerBIzNess

 

Try replacing "MAX" with "EARLIER"


Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad

 

Thanks for the reply. That made the number's a little less crazy but something is still throwing it off..

 

Capture.PNG

Hi @PowerBIzNess

 

Please could you share your file via googledrive or onedrive or copy paste dataset


Regards
Zubair

Please try my custom visuals

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.

Top Solution Authors