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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
CalleWagenaar
Frequent Visitor

How to create a bar chart using start and end times.

I have another questin now. I am trying to create a graph showing how many cars are drving at a certain hour. To do this I have start times and end times in my data.  have created a time frequancy graph based on start times, which shows how many cars start at a certain time: 

CalleWagenaar_0-1671808764044.png

 

However this only shows the start times. How do I geth this graph to show the time inbetween the stat and the end time. For example: 
If a car drove from 10:00 -13:00 using only strta times it adds one point to 10:00. I need it to add a point to 10:00, 11:00 and 12:00. How can I do this? 

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

Hi @CalleWagenaar ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1672368336547.png

Please try:

First create a new time table:

vjianbolimsft_1-1672368435676.png

Then create a measure:

Measure = SUMX('Table',IF([Start Time]<=MAX('Time'[Time])&&[End Time]>=MAX('Time'[Time]),1))

Apply it to the visual:

vjianbolimsft_2-1672368473548.png

Final output:

vjianbolimsft_3-1672368488194.png

Best Regards,

Jianbo Li

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-jianboli-msft
Community Support
Community Support

Hi @CalleWagenaar ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1672368336547.png

Please try:

First create a new time table:

vjianbolimsft_1-1672368435676.png

Then create a measure:

Measure = SUMX('Table',IF([Start Time]<=MAX('Time'[Time])&&[End Time]>=MAX('Time'[Time]),1))

Apply it to the visual:

vjianbolimsft_2-1672368473548.png

Final output:

vjianbolimsft_3-1672368488194.png

Best Regards,

Jianbo Li

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

This doesn't work for me, when I follow the step there are no errors. However when I try to create the graph it is blank.

I exactly followed your steps with your exact data and there is still no resut

lbendlin
Super User
Super User

In Power Query you can use List.Generate to create the time series for each car (with hourly granularity), from Start date/hour to end date/hour.  Then you can use these calculated data points in your visual.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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