Forum Discussion
Formatting a bar graph
- 6 years ago
If that is how your source data is actually formatted, you need to unpivot all of those columns in Power Query and then the solution is trivial. Otherwise, create a disconnected table that lists your columns (categories). Use this as the Axis for your chart. Then create a measure that uses a SWITCH statement and based on the value in the axis, sum the right column as the return value for the measure.
If that is how your source data is actually formatted, you need to unpivot all of those columns in Power Query and then the solution is trivial. Otherwise, create a disconnected table that lists your columns (categories). Use this as the Axis for your chart. Then create a measure that uses a SWITCH statement and based on the value in the axis, sum the right column as the return value for the measure.
- Anonymous6 years agoNot applicable
can I unpivot using dax? I dont want to mess up all my other visuals
- Greg_Deckler6 years agoCommunity Champion
As a matter of fact, yes you can. I wrote a quick measure to do exactly that. https://community.powerbi.com/t5/Quick-Measures-Gallery/DAX-Unpivot/m-p/574832#M256.
However, that will not solve your problem since you still need something to put in the Axis. Sounds like you are headed down the disconnected table trick, this blog article demonstrates the technique. https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563
- Anonymous6 years agoNot applicable
thank you!! you are awesome!
- Anonymous6 years agoNot applicable
do you have a quick example of the switch statment to use in this case? I just created the table of all the categories for the axis