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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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