The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Solved! Go to Solution.
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.
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.
@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
@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:
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
80 | |
71 | |
51 | |
50 |
User | Count |
---|---|
123 | |
119 | |
76 | |
64 | |
60 |