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
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
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 Kudoed Authors