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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
chq
Helper II
Helper II

Sum of Distinct Counts

I need to be able to total each of these distinct counts, not just see the number of distinct counts. 

Essentially I want a total of each rows distinct count. Can that be done? I had to scrub the data so below is what the table looks like in Power Bi, followed by the table where the data is stored. 


I just want to be able to sum each rows distinct count....

Any ideas? Thanks!
This is What Power Bi is giving meThis is What Power Bi is giving meThis is what the data is based onThis is what the data is based on

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@chq try following measure

 

# Count = SUMX( VALUES( 'Table'[Event Title] )  ,CALCULATE(DISTINCTCOUNT( 'Table'[ID#] ) ))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@chq try following measure

 

# Count = SUMX( VALUES( 'Table'[Event Title] )  ,CALCULATE(DISTINCTCOUNT( 'Table'[ID#] ) ))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks that looks like it works!

If I wanted to apply a filter for a year to the measure what would I need to add? I tried this but it does not appear to work.

SUMX(FILTER('Table',[Date]=2019), VALUES( 'Table'[Event Title] ) ,CALCULATE(DISTINCTCOUNT( 'Table'[ID#])))

@chq try this

 

# Count = SUMX( ALLSELECTED( 'Table'[Event Title] )  ,CALCULATE(DISTINCTCOUNT( 'Table'[ID#] ) ))


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

That gives me the same number as before.

I need to be able to compare the sums of two different years using the original formula you provided. Is there any way to apply a filter to the equation to achieve this? Thanks

Cmcmahan
Resident Rockstar
Resident Rockstar

There's no need to change the equation.  PowerBI measures work amazingly with the current context of a visual.  

 

If you create a table and add years to it, and then add this measure, it will calculate the measure for each year for you!  If you add other categories, it will work for each subgrouping of rows.  

How would I be able to calculate the difference between the two years though? I need to be able to show percent change and the total count difference.

Cmcmahan
Resident Rockstar
Resident Rockstar

If you've only got 2 years of data you want to compare at a time, then this solution should work for you:

 

https://community.powerbi.com/t5/Desktop/Difference-between-two-columns-or-rows/td-p/188185

It actually contains up to five years at any given time. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.