Forum Discussion

lia_viegas's avatar
lia_viegas
Regular Visitor
9 years ago
Solved

Creating a chart using the same legend to different columns

Hello!

 

I've just started to use Power BI to create dashboards and I have a big issue to solve. My table is like this:

 

 

 

IDQ1Q2
1YesYes
2YesYes
3YesNo
4NoYes
5NoYes
5NoNo
6YesYes
7NoYes
8YesNo
9NoYes
10NoNo

 

 

 And I want to create a barchart where I use Yes/No as my legend and bars are grouped by my table's columns, as in this image:

 

 

 

A partner told me that the only way I could do it was by creating a new table like this one:

 

IDQ1Q2
1YesQ1
2YesQ1
3YesQ1
4NoQ1
5NoQ1
5NoQ1
6YesQ1
7NoQ1
8YesQ1
9NoQ1
10NoQ1
1YesQ2
2YesQ2
3YesQ2
4NoQ2
5NoQ2
5NoQ2
6YesQ2
7NoQ2
8YesQ2
9NoQ2
10NoQ2

 

 

But I trully believe there is another solution and we are not figuring it out.

 

Could you help me with this issue?

 

Big thanks!

 

 

 

 

4 Replies

  • Sean's avatar
    Sean
    Community Champion

    lia_viegas

    Look at ALL my responses in this post (you will have to unpivot)

    http://community.powerbi.com/t5/Desktop/Multiple-Stacked-Bar-Charts/m-p/111938#M47176

     

    EDIT:

    Its really very easy - click Edit Queries

    In the Query Editor => select the ID Column => Transform tab  => Unpivot Columns => Unpivot Other Columns

    Now double click on the new column names and rename each => then Home tab => Close & Apply

    build your chart!

     

    That's it!

    Good Luck! :smileyhappy:

     

     

    • lia_viegas's avatar
      lia_viegas
      Regular Visitor

      Hello, Sean,

       

      Thanks for your answer and sorry for my late reply.

       

      So the only thing I can do is what you suggested? What will happen if in the case I must update the data table every week?  My table is kind of big (2000 lines/month, 30 columns), so after unpivoting columns I'll have 60000 lines, will it be a problem?

       

      Thanks again!

      • v-ljerr-msft's avatar
        v-ljerr-msft
        Microsoft Employee

        Hi lia_viegas,

         

        I agree with Sean that the Unpivot option may be the best choice in this scenario. And I don't think 60000 lines could be a problem. It's worth a try.:smileyhappy:

         

        Regards