Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi all.
New here so go easy on me.
I'm using PowerBI for the past few months (or at least trying to use) at my workplace, so far with some success.
I'm currently working on a diabetes clinic: multidisciplinary approach where the patients can be seen by a number of specialists from medical doctors to podologists.
The thing is, at the moment we are preparing next year budget and I though of doing part of the job using PowerBI.
So, to begin:
We have ate the moment more than 2000 patients in the clinic, and each one is diabetic but also as other problems, including differente complications from diabetes.
I have at the moment several excel files:
To be able to work it in PowerBI I imported file 1 and merged all the files in point 3 - something like:
Patient | diagnosis
a y
b y
c y
d y
a x
b x
f x
b w
and so on...
So far so good.
A create a dashboard and it's here the real trouble begins:
I can count how many of my diabetic patients are obese, I can count how many smoke or how many have eye problems. What I'm still unable to do is, for instance, calculate how many have 2, 3 or whatever number os diagnosis I choose from, in common.
Can someone share some ideas?
Thanks
Alexandre
Solved! Go to Solution.
Hi @aleph_heideger,
Based on my assumption, the report has a slicer lists all diagnosis, now you want to calculate how many patients have all diagnosis you selected from slicer, right?
If above result meets your requirement, please create measures like below:
NO of diagnosis per patient = CALCULATE ( COUNT ( patient[Patient] ), ALLSELECTED ( patient[diagnosis] ) ) Select number = CALCULATE ( DISTINCTCOUNT ( patient[diagnosis] ), ALLSELECTED ( patient[diagnosis] ), ALLSELECTED ( patient[Patient] ) ) flag = IF ( [NO of diagnosis per patient] = [Select number], 1, 0 ) NO of patient that have all diagnosis selected = CALCULATE ( DISTINCTCOUNT ( patient[Patient] ), FILTER ( patient, [flag] = 1 ) )
I have uploaded my pbix file for your reference.
Best regards,
Yuliana Gu
An update regarding the proposed solution:
I couldn't make it work on my files: with a small test file the results came out ok but with a more real file items just added up.
I searched through the forums and found a differente approach:
Doentes com todos os diagnosticos = COUNTROWS ( EXCEPT ( VALUES ( DIAGNOSTICOS[Utente] ), SUMMARIZE ( GENERATE ( VALUES ( DIAGNOSTICOS[Utente] ), EXCEPT ( VALUES ( DIAGNOSTICOS[ICPC] ), CALCULATETABLE ( VALUES ( DIAGNOSTICOS[ICPC] ) ) ) ), DIAGNOSTICOS[Utente] ) ) ) + 0
Assuming:
DIAGNOSTICOS is the name of the table
Utente is the patient name/reference
ICPC is the diagnosis code
An update regarding the proposed solution:
I couldn't make it work on my files: with a small test file the results came out ok but with a more real file items just added up.
I searched through the forums and found a differente approach:
Doentes com todos os diagnosticos = COUNTROWS ( EXCEPT ( VALUES ( DIAGNOSTICOS[Utente] ), SUMMARIZE ( GENERATE ( VALUES ( DIAGNOSTICOS[Utente] ), EXCEPT ( VALUES ( DIAGNOSTICOS[ICPC] ), CALCULATETABLE ( VALUES ( DIAGNOSTICOS[ICPC] ) ) ) ), DIAGNOSTICOS[Utente] ) ) ) + 0
Assuming:
DIAGNOSTICOS is the name of the table
Utente is the patient name/reference
ICPC is the diagnosis code
Hi @aleph_heideger,
Based on my assumption, the report has a slicer lists all diagnosis, now you want to calculate how many patients have all diagnosis you selected from slicer, right?
If above result meets your requirement, please create measures like below:
NO of diagnosis per patient = CALCULATE ( COUNT ( patient[Patient] ), ALLSELECTED ( patient[diagnosis] ) ) Select number = CALCULATE ( DISTINCTCOUNT ( patient[diagnosis] ), ALLSELECTED ( patient[diagnosis] ), ALLSELECTED ( patient[Patient] ) ) flag = IF ( [NO of diagnosis per patient] = [Select number], 1, 0 ) NO of patient that have all diagnosis selected = CALCULATE ( DISTINCTCOUNT ( patient[Patient] ), FILTER ( patient, [flag] = 1 ) )
I have uploaded my pbix file for your reference.
Best regards,
Yuliana Gu
I think that may do the trick.
I tried on my old database but could't replicate the results. Maybe some noise from other measures, I don't know.
EDIT:
I tried with a clean excel file and was able to get exactly what I wanted. Now I'll try to debug why the heck it didn't work in my first file.
Many thanks.
Hi @aleph_heideger,
If you work it out, appreciate that you could share the valid solution.
Thanks,
Yuliana Gu
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
39 | |
35 |
User | Count |
---|---|
107 | |
56 | |
52 | |
48 | |
40 |