Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Create a bar chart from Multiple Columns

Hi, I have some columns like this:

 

ApplicationMelbourne?Sydney?Brisbane?New York?
PacmanYes YesYes
PinballYesYes  
Space InvadersYes Yes 
Street Fighter Yes Yes

 

I would like to create a bar chart/pie chart that shows Application by location. I'm still pretty new to Power BI, but I can't figure out how to do this. Alternatively, I can get the data like this:

 

ApplicationLocations
PamanMelbourne; New York
PinballMelbourne; Sydney
Space InvadersMelbourne; Brisbane
Street FighterSydney; New York

 

But I don't know how to create the visualisations from this source either (which would actually be preferrable. Thanks so much for your help!

 

edit: Not sure who "accepted" this as a solution, but it is NOT solved.

 

 

  • Anonymous 

     

    The easiest way is to unpivot the city columns in Power Query. Select the query, select the "city" columns" and choose "unpivot columns" in the ribbon:

     

    This will ransform the table to this structure, where you now have th cities as a column which you can use in the visuals as a field.

     

    You can now create you visuals. For example:

     

5 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Anonymous 

     

    The easiest way is to unpivot the city columns in Power Query. Select the query, select the "city" columns" and choose "unpivot columns" in the ribbon:

     

    This will ransform the table to this structure, where you now have th cities as a column which you can use in the visuals as a field.

     

    You can now create you visuals. For example:

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Paul,

       

      Thanks for this. Is there any way to do this with the second table? I use a lot of fields that contain multiple values from "label-type inputs".

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        In the query editor, rIght click on the heading of the second table and click on Split by delimiter.  Select the delimiter as ; and under Advanced options, select split by rows.  Click on Close and Apply.

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Anonymous 

    If the suggestion solves your issue, could you kindly mark it as a solution? This helps others looking for similar solutions. If you need further help, let us know!

  • v-cazheng-msft's avatar
    v-cazheng-msft
    Community Support

    Hi, Anonymous 

    Is your problem solved? If there some posts help, then you can consider marking them as solutions. If not, please provide more details about your issue.

     

    Best Regards

    Caiyun Zheng