March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have an unpivoted table of survey data where respondents could choose more than one of several options.
Survey ID | Infection | Response |
0001 | Sinusitis | Selected |
0001 | Sepsis | Selected |
0002 | Pneumonia | Selected |
0003 | Sepsis | Selected |
0003 | Pneumonia | Selected |
I would like to create a table that shows the percent of respondents that chose each infection.
Infection | % of respondents |
Sinusitis | 33% |
Sepsis | 66% |
Pneumonia | 66% |
I tried using SUMMARIZE, but I can't seem to get the correct denominator. The COUNTDISTINCT below counts only the distinct Survey IDs within the infection category instead of in the entire table, so I get 100% for every type of infection. Maybe SUMMARIZE is the wrong way to go? Thanks in advance for any help!
Solved! Go to Solution.
This question is much more complex than you might think, but here is a simplistic approach that takes some liberties.
Hi @klontok ,
If you want to create a calculation table, I have made a modification on the formula you provided, refer below:
Table_ =
SUMMARIZE(
'Infections Prior to Diagnosis',
'Infections Prior to Diagnosis'[Infection],
"Percent of respondents",
DIVIDE(
CALCULATE (
COUNTROWS('Infections Prior to Diagnosis'),
FILTER(
ALL('Infections Prior to Diagnosis'),
'Infections Prior to Diagnosis'[Infection] = VALUES('Infections Prior to Diagnosis'[Infection])
)
),
CALCULATE(
DISTINCTCOUNT('Infections Prior to Diagnosis'[Survey ID]),
ALL('Infections Prior to Diagnosis')
)
)
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @klontok ,
If you want to create a calculation table, I have made a modification on the formula you provided, refer below:
Table_ =
SUMMARIZE(
'Infections Prior to Diagnosis',
'Infections Prior to Diagnosis'[Infection],
"Percent of respondents",
DIVIDE(
CALCULATE (
COUNTROWS('Infections Prior to Diagnosis'),
FILTER(
ALL('Infections Prior to Diagnosis'),
'Infections Prior to Diagnosis'[Infection] = VALUES('Infections Prior to Diagnosis'[Infection])
)
),
CALCULATE(
DISTINCTCOUNT('Infections Prior to Diagnosis'[Survey ID]),
ALL('Infections Prior to Diagnosis')
)
)
)
Best Regards,
Adamk Kong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This question is much more complex than you might think, but here is a simplistic approach that takes some liberties.
Thank you so much! I was assuming I had to create another table, but the measure actually works better for my purposes because the slicers filter it.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
16 | |
16 | |
12 |