Forum Discussion
Stacked Bar Chart
Hi
In the below visual, my source data is as it appears in the upper table, but I need to find a way to manipulate the data so it appears like it does in the lower table.
I need to create a stacked bar chart in power bi as in the example below, and I can do that by using the upper table as a source, but I can not find a way to sort it so that the most billable time is sorted first, then the non-billable, then the absence, but I can only get it to sort by total time. With the lower table as a source this is not a problem.
Can anyone enlighten me as to how I can either transform the upper table to the lower one, or how I can get my desired result from the structure in the upper table?
Hi Danbert ,
Dummied up a table for you, you will end up with a table like this by selecting the Type Column and Selecting Pivot on the Transform tab. Use Time as the values.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
NathanielThe picture below shows both the selection for Pivot Column and the resulting table.
8 Replies
- Nathaniel_CCommunity Champion
Hi Danbert ,
Would you copy and paste your first table right into the message so that we can copy and paste it into Power Query? Cannot do that with pictures.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel- Nathaniel_CCommunity Champion
Hi Danbert ,
Dummied up a table for you, you will end up with a table like this by selecting the Type Column and Selecting Pivot on the Transform tab. Use Time as the values.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
NathanielThe picture below shows both the selection for Pivot Column and the resulting table.
- DanbertFrequent Visitor
Hi Nathaniel_C , of course, sorry about that. Please see below:
User TimerLogDuration JobType JobTypeID John Smith 50 Billable 1 Dave Brown 100 Non-Billable 2 Mary Jones 15 Billable 1 John Smith 150 Billable 1 John Smith 200 Absent 3 Sally Wood 27 Non-Billable 2 Frank Walston 35 Billable 1 Sally Wood 84 Absent 3 Frank Walston 94 Non-Billable 2 - Nathaniel_CCommunity Champion
Hi Danbert beat you to it with a dummy table. Let me know if this makes sense.😁