cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.

1 ACCEPTED SOLUTION
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:

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.

3 REPLIES 3
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:

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.

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

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?

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

#### Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors