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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

How to show total row as sum of distinct count?

In our data we're taking a distinct count for different metrics and summing the time associated with the number of items worked by employees.  For the Total row instead of showing the distinct count across all items worked, we would like to show the sum of the distinct counts.  In the attached example, for TICKET instead of showing 244 we would like to show 289 as that is the sum of all distinct counts.  What is the best way to go about this?  Thanks in advance.

ebrazis_0-1602018348940.png

 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

You can try this measure:

SumDistinctCount_new =

var _new=SUMMARIZE('Table','Table'[Time(Hours)],"_value",[SumDistinctCount])

return IF(HASONEVALUE('Table'[Time(Hours]),[SumDistinctCount],SUMX(_new,[_value]))

 

If you still have problems, maybe you can take a look at this blog, which explains this question in detail:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

You can try this measure:

SumDistinctCount_new =

var _new=SUMMARIZE('Table','Table'[Time(Hours)],"_value",[SumDistinctCount])

return IF(HASONEVALUE('Table'[Time(Hours]),[SumDistinctCount],SUMX(_new,[_value]))

 

If you still have problems, maybe you can take a look at this blog, which explains this question in detail:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , Create a measure like this

 

sumx(values(Table[Group]), calculate(distinctcount(Table[column])))

 

//Here group is the row/group by/axis

and Column is column you want to take distinctcount

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak - Thanks for the suggestion.  I took what you provided, created a measure, and added it to the table.  However, I'm not sure what I'm doing incorrectly.  As you can see the new column (SumDistinctCount) is not calculating the way I need.  Now, the Total for SumDistinctCount under TICKET is adding up correctly to 617, but that number is incorrect as it should be 289 since that is what the Count column under TICKET adds up to if you manually add each line together.  Any idea what I may have done wrong.  The measure looks like this: 

SumDistinctCount = SUMX(VALUES('Activity - Combined'),CALCULATE(DISTINCTCOUNT('Activity - Combined'[IMAGE_ID])))
 
As a note, the Count column in the table is taking a distinct count of 'Activity - Combined'[IMAGE_ID]
 
What I really need to do is be able to add up the values in the Count column, is that possible?
 

ebrazis_0-1602104568986.png

 

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.