Forum Discussion

djankuna's avatar
djankuna
Frequent Visitor
2 years ago
Solved

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):

desired chart:

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
  • 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:

     

     

    Rename columns as desired:

     

     

5 Replies

  • 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:

     

     

    Rename columns as desired:

     

     

  • djankuna's avatar
    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's avatar
        djankuna
        Frequent Visitor

        Hi,

         

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

         

         

        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: 

         

        regards,

         

        Dovile