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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
joshua1990
Post Prodigy
Post Prodigy

Stacked Bar Chart as timeline

Hello everyone!

I have a table that contains the durations with the corresponding DateTimes:

StartEndDurationType
01.01.2021 00:00:0001.01.2021 05:00:0005:00:001

 

Now I would like to use a stacked bar chart with the hours on the x-axes. Then I would like to sum up the individual types to see the performance like in a timeline chart.

Is this possible in PBI?

To use a stacked bar chart with an hours axe as a timeline? 

 
 

 

 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @joshua1990 

According to your description, you want to create a stacked bar chart with the hours on the x-axis and sum up the individual types to see the performance like in a timeline chart, I think you can transform the data type of [Duration] first to put it into the chart first. You can try my steps:

This is my test data based on your sample data:

v-robertq-msft_0-1613641669700.png

  1. Create a calculated column:
Duration(Hour) =

LEFT([Duration],1)

Then change the data type to decimal number:

v-robertq-msft_1-1613641669706.png

 

  1. Then you can create a stacked bar chart and place it like this:

v-robertq-msft_2-1613641669731.png

 

And I guess this can be what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-robertq-msft
Community Support
Community Support

Hi, @joshua1990 

According to your description, you want to create a stacked bar chart with the hours on the x-axis and sum up the individual types to see the performance like in a timeline chart, I think you can transform the data type of [Duration] first to put it into the chart first. You can try my steps:

This is my test data based on your sample data:

v-robertq-msft_0-1613641669700.png

  1. Create a calculated column:
Duration(Hour) =

LEFT([Duration],1)

Then change the data type to decimal number:

v-robertq-msft_1-1613641669706.png

 

  1. Then you can create a stacked bar chart and place it like this:

v-robertq-msft_2-1613641669731.png

 

And I guess this can be what you want.

You can download my test pbix file here

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

MFelix
Super User
Super User

Hi @joshua1990 ,

 

Not sure if the duration is all the same but in order to used it has a x-axis values if you create a new column with the following setup you can have a text column that can be use to see the data:

String Duration in Hours and Minutes = 
var vMinues='Table'[Duration] * 24
var vHours=int( vMinues )
var vRemainingMinutes=MOD(vMinues; 60)
return
  vHours&" H"& vRemainingMinutes & " M"

 

Assuming your column is in duration:

 
 

hours.png

 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



@MFelix Thank you! But what I want to see is the evolution of the individual types. More like:

02:00:00 = 2 h (Type 1)

04:00:00 = 2 h (Type 2)

08:00:00 = 4 h (Type 1)

16:00:00 = 8 h (Type 2)

I want to use the stacked bar chart as a timeline

Hi @joshua1990 ,

 

Just to be clear about the data, are all your values within the values you show so 2, 4, 8, 16 hours or are you groupingf them so everything from 0 to 2 is on 2 hours , from 2 to 4 hours is on the 4 hours?

 

Also how is the sum for each type is the total values for that specific value? 

Example if you have 3 lines wih 1H each you consider 3 hours on the 2H bar?


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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