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
Hi experts,
I have a large dataset that looks (simplified!) like this:
For diseases, 0 = no disease and 1 = disease.
What I want to show is prevalence by cohort i.e., incidence / Total # participants in particular cohort.
I also want to keep the Participant Number so I can later slice by gender age etc from a dimension table.
I have played around with unpivoting the Disease columns and can calculate total incidence, but am not able to get prevalence to work on a visual (it always comes out at 100%).
My DAX was simply:
Total Incidence = COUNTROWS('Table')
Total Distinct Participants = DISTINCTCOUNT('Table'[Participant Number])
Prevalence = DIVIDE([Total Incidence],[Total Distinct Participants])
Whilst this work in card visuals and can be filtered by cohort, it doesn't work on a bar chart to show by condition:
(Condition is the name of the unpivoted column).
Any advice greatly appreciated.
Best,
Soph
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 |
---|---|
21 | |
19 | |
18 | |
18 | |
14 |
User | Count |
---|---|
36 | |
34 | |
20 | |
19 | |
15 |