Forum Discussion
Calculating proportions with DAX
- 10 years ago
russm - With the data you posted, I created 2 new columns in Dictionary:
Count of Issues = CALCULATE(COUNTROWS(DISTINCT(Verbatims[UUID])),RELATEDTABLE(Verbatims))
Percent of Issues = [Count of Issues] / COUNTROWS(DISTINCT(Verbatims[UUID]))
I get the visualization:
I think I like Sean's better as it shows the total unique (6) and the percentage comes out to 100%. I guess it is just what makes more sense to your users, not all of the issues adding up to 9 or having 150%. Or, just turn off the totals row and don't tell them.
- 10 years ago
Sean - Assuming that your formulas are for measures, correct?
- 10 years ago
Yes all Measures.
Thanks for the quick response!
Sort of. What I'm after is more like this (count of issues included for clarity):
| Category | Count of Issues | % of issues by Distinct UUID |
| GENERAL | 4 | 67% |
| Ports | 3 | 50% |
| Startup | 1 | 17% |
| Internet/Connectivity | 1 | 17% |
Where: Distinctcount(Verbatims)[UUID] = 6
(Apologies for the hex code in the original post. I should've just used names)
russm - With the data you posted, I created 2 new columns in Dictionary:
Count of Issues = CALCULATE(COUNTROWS(DISTINCT(Verbatims[UUID])),RELATEDTABLE(Verbatims))
Percent of Issues = [Count of Issues] / COUNTROWS(DISTINCT(Verbatims[UUID]))
I get the visualization:
I think I like Sean's better as it shows the total unique (6) and the percentage comes out to 100%. I guess it is just what makes more sense to your users, not all of the issues adding up to 9 or having 150%. Or, just turn off the totals row and don't tell them.