Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi there!
I'm currently trying to display some data in my report using a 100% Stacked Bar Chart, but the data isn't structured in a way that this visual supports. I'm looking for a way to restructure the data but haven't found a good way to do that just yet. I'd love it if some of you could help me figure this one out! You can download a sample .pbix file for this problem here: https://www.dropbox.com/s/qvxxh0mdcvtaw1i/Sample.pbix?dl=0 😉
The data I'm working with represents applications, and the various categories using which the applications are judged. There's a column for each category, and a row for each application (identified using a numerical ID). For each category, there's an option for yes, maybe and no. The data is structured as such (data and categories are fake):
id | age_okay | education_okay | area_okay | motivation_okay | experience_okay | license_okay |
11 | yes | yes | yes | yes | yes | yes |
22 | yes | yes | maybe | yes | maybe | yes |
33 | yes | maybe | yes | yes | yes | yes |
44 | no | no | yes | yes | maybe | yes |
55 | maybe | no | no | no | no | no |
My target is to display this data in a 100% Stacked Bar Chart, which will look something like this:
This way, it's easy to see all of the data in a single visual, and it's easy to compare what categories applicants are most commonly rejected for. The data can be filtered further by ID and a bunch of other data in the full report. Problem is... with the way the data is currently structured, there doesn't seem to be a way to display the data like this.
My idea was to create a second table in which the data is structured differently (keeping the original intact for other visuals). This second table would have a layout like this:
category | id | yes | maybe | no |
age_okay | 11 | 1 | ||
education_okay | 11 | 1 | ||
area_okay | 11 | 1 | ||
motivation_okay | 11 | 1 | ||
experience_okay | 11 | 1 | ||
license_okay | 11 | 1 | ||
age_okay | 22 | 1 | ||
education_okay | 22 | 1 | ||
area_okay | 22 | 1 | ||
motivation_okay | 22 | 1 | ||
experience_okay | 22 | 1 | ||
license_okay | 22 | 1 | ||
age_okay | 33 | 1 | ||
education_okay | 33 | 1 | ||
area_okay | 33 | 1 | ||
motivation_okay | 33 | 1 | ||
experience_okay | 33 | 1 | ||
license_okay | 33 | 1 | ||
age_okay | 44 | 1 | ||
education_okay | 44 | 1 | ||
area_okay | 44 | 1 | ||
motivation_okay | 44 | 1 | ||
experience_okay | 44 | 1 | ||
license_okay | 44 | 1 | ||
age_okay | 55 | 1 | ||
education_okay | 55 | 1 | ||
area_okay | 55 | 1 | ||
motivation_okay | 55 | 1 | ||
experience_okay | 55 | 1 | ||
license_okay | 55 | 1 |
With this data, I can easily place each category on the Y-axis, and place the yes, maybe and no values on the X-axis. I've included the above table in the .pbix file, and used that to create the visual seen above.
The steps to transform this data would be something along these lines, in my mind:
So my question to you all is: how would I restructure the data like this in Power BI? I'm quite new to DAX and PowerQuery, so while I've tried a couple of things I haven't been able to create the table I need. If there's a better way to display the data in a single visual, I'd be open to suggestions for that too!
Solved! Go to Solution.
@Igadeer , Unpivot the first table. If required pivot again
https://radacad.com/pivot-and-unpivot-with-power-bi
@Igadeer , Unpivot the first table. If required pivot again
https://radacad.com/pivot-and-unpivot-with-power-bi
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
87 | |
83 | |
65 | |
49 |
User | Count |
---|---|
127 | |
108 | |
89 | |
70 | |
66 |