Forum Discussion
Stacked Bar Chart - multiple columns - same chart
Hi All,
I'm looking to create a stacked bar chart with multiple columns from the table. I know I can create a stacked chart with a single column by putting the column name in 'Legend' but is there a way to do that for multiple columns?
Here's the sample survey data:
| S. No. | CIO | IT | LOB |
| 184 | Primary Decision maker | Primary Decision maker | Influencer |
| 684 | Primary Decision maker | Primary Decision maker | Influencer |
| 1082 | Influencer | Influencer | Primary Decision maker |
| 1119 | Influencer | Primary Decision maker | Primary Decision maker |
| 1171 | Influencer | Influencer | Influencer |
| 281 | Primary Decision maker | Primary Decision maker | Primary Decision maker |
| 872 | Primary Decision maker | NA | Primary Decision maker |
| 919 | Primary Decision maker | NA | Influencer |
| 1145 | NA | Primary Decision maker | Primary Decision maker |
| 156 | NA | Primary Decision maker | Primary Decision maker |
| 367 | NA | NA | NA |
| 709 | NA | NA | NA |
And this is the kind of output I'm looking for:
Thanks in advance.
Cheers,
Nikhil
- Anonymous5 years ago
Hello Nikhil,
1)First you need to unpivot all columns except S. No. column in power query editor.
2)Make a summary table grouping by both the columns obtained after unpivoting using count as summarization using Summarize Dax function.
3)Plot the columns of the summary table in a Stacked Column Chart. Output will look as below.
Here is the .pbix file.
4 Replies
- AnonymousNot applicable
Hello Nikhil,
1)First you need to unpivot all columns except S. No. column in power query editor.
2)Make a summary table grouping by both the columns obtained after unpivoting using count as summarization using Summarize Dax function.
3)Plot the columns of the summary table in a Stacked Column Chart. Output will look as below.
Here is the .pbix file.
- batranikhilFrequent Visitor
Great thanks! Unpivot is the key. 🙂
- KumailImpactful Individual
Hello batranikhil
If you could send sample .pbix that demonstrate what you are looking to get. It would really help providing you a quick solution.
You can send the sample .pbix file by adding it to your drive or dropbox and add the link here.
Regards
Kumail Raza- batranikhilFrequent Visitor
Hi Kumail - thanks for your response. I am looking to get the above stacked bar chart output as in the image with the table that I pasted above. I couldn't achieve it or havent seen it so don't have a sample so as to what output would look like in *.pbix. Hope I understood your request clearly.