Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Danbert
Frequent Visitor

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?

 

 

Capture.PNG

1 ACCEPTED SOLUTION

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.
Nathanielpivot 234.PNG

 







pivot 23.PNG

 The picture below shows both the selection for Pivot Column and the resulting table.

pivot 2.PNG

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

8 REPLIES 8
Nathaniel_C
Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @Nathaniel_C , of course, sorry about that.  Please see below:

 

UserTimerLogDurationJobTypeJobTypeID
John Smith50Billable1
Dave Brown100Non-Billable2
Mary Jones15Billable1
John Smith150Billable1
John Smith200Absent3
Sally Wood27Non-Billable2
Frank Walston35Billable1
Sally Wood84Absent3
Frank Walston94Non-Billable2

Hi @Danbert beat you to it with a dummy table. Let me know if this makes sense.😁





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @Danbert 
Using your table. pivot 2345.PNG

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@Nathaniel_C  - that worked perfectly, thanks so much that's saved me a lot of time!

Hi @Danbert ,

You are very welcome, glad to help!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@Nathaniel_C, thanks so much for coming back to me so quickly on this.  I won't be able to test this until tomorrow but looks exactly like what I'm after.  I'll report back tomorrow.

Thanks again.

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.
Nathanielpivot 234.PNG

 







pivot 23.PNG

 The picture below shows both the selection for Pivot Column and the resulting table.

pivot 2.PNG

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors