Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
djankuna
Frequent Visitor

Creating a chart with several Columns (values 1, 0) into ONE Single Diagram

Hello all,
I am seeking help with a Power BI issue I'm facing.
 
I am working on a dataset where I have several separate columns representing the presence of different diseases (1 = disease present, 0 = disease not present, multiple diseases per subject can be possible). My goal is to create a single diagram that represents only the diseases that are present, based on a '1' in any of these columns.
 
Example:
1. current view (only one disease possible, adding others on top does not work):
djankuna_0-1714669579662.png

desired chart:

djankuna_1-1714669667675.png

I'm seeking any advice on how to make this into a desired single diagram. Are there other Power BI features or data transformations I should consider to visualize the existence of diseases in a single chart?

 
Thank you in advance for your help!
 
Best, 
Dovile
1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@djankuna,

 

If you unpivot the disease columns, the data will be easier to visualize. In Power Query, select the disease columns and select Unpivot Columns:

 

DataInsights_0-1714675003210.png

 

Rename columns as desired:

 

DataInsights_1-1714675022192.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
djankuna
Frequent Visitor

Dear @DataInsights ,

 

this worked perfectly, thanks a lot!

 

In some cases same subject had multiple diseases, so now that I filtered 1 in "disease present", there are multiples the subject records as well (e.g., patient ID = 18 has two lines, one for each of the two diseases). Do you maybe know if there is a way to prevent this duplication, but still showing the disease seperatelly?

 

As this also duplicates the other parameters the subjects have, that should be displayed one per subject anyway.

 

thanks a lot!

 

Dovile 

@djankuna,

 

Would you be able to provide the expected result for the scenarios you mentioned?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi,

 

Yes. Unpivot solution created duplicate records in my dataset. Example ID 93, same subject but 2 lines for each of the disease condition:

 

djankuna_2-1714977061415.png

djankuna_3-1714977070979.pngdjankuna_4-1714977085809.png

 

now for other graphs this information has been displayed several times as well (e.g., gender --> 2x female). So in case i would need to tell how many females are included, this will not be 100 % accurate. 

 

is there any way to show all the results as per ID, but still keep the unpivot for disease column?

 

93: 

djankuna_5-1714977367486.png

 

regards,

 

Dovile 

@djankuna

 

You could create a measure using DISTINCTCOUNT like this:

 

Count Subject = DISTINCTCOUNT ( 'Table'[Subject] )

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




DataInsights
Super User
Super User

@djankuna,

 

If you unpivot the disease columns, the data will be easier to visualize. In Power Query, select the disease columns and select Unpivot Columns:

 

DataInsights_0-1714675003210.png

 

Rename columns as desired:

 

DataInsights_1-1714675022192.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.