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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
gantunes
New Member

bar chart period start & end

Hi


Can someone help me build a bar graph that has a period (start and end) with a value

 

the idea is to create something like this:

 

gantunes_0-1721646839013.png

 

 

 

table sample:

rate - bar size (Y axis)

reason - color 

Time range - start and end of bar

 

rateTIME RANGEreason
23  12:00 -    14:00G
16  05:10  -    05:30W
12  05:00 -    05: 10W
20  05:30 -    08:40W
23  08:40 -    11:00G
1 REPLY 1
hackcrr
Super User
Super User

Hi, @gantunes 

ou need to split the TIME RANGE column into separate Start Time and End Time columns:

Go to Transform Data to open Power Query Editor.
Select the TIME RANGE column.
Use the Split Column feature to split by delimiter (-).
Rename the new columns to Start Time and End Time

Change the data type of the Start Time and End Time columns to DateTime. Adjust the times by adding a date if needed (e.g., the same date for all entries).

Go back to the main Power BI report view:
Select a Stacked Bar Chart or Clustered Bar Chart.
Drag the rate column to the Values field.
Drag the Start Time column to the Start field or to the Axis field.
Drag the End Time column to the End field 
Drag the reason column to the Legend field to color code by reason.

Click on the X-Axis in the visual. Format the X-Axis to display time.

If you want more control or a visual specifically designed for Gantt charts:

Go to the AppSource marketplace within Power BI. Search for Gantt Chart visuals and add one to your Power BI report. Use the custom Gantt chart visual to map rate, Start Time, End Time, and reason. 

If you need to calculate durations or other metrics, you might use DAX measures like this:

Duration = DATEDIFF('YourTable'[Start Time], 'YourTable'[End Time], MINUTE)

Ensure rate is on the Y-Axis. Ensure Start Time and End Time are correctly configured. Use reason to color the bars.

 

hackcrr

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

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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