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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
chasuk19
Frequent Visitor

Hourly Duration Chart Help

Hi all, i'm struggling with some data, in which I need to SUM the duration of a list of tasks and spread this duration on a graph/line chart across an hourly basis.

 

My data set shows the task, it's start and end time and duration. (i also have date, but filtered out for this).

 

Task  End TimeDurationStart Day
Task 123:45:0002:45:00Monday
Task 123:55:0002:35:00Monday
Task 218:00:0001:15:00Tuesday

 

chasuk19_0-1634146649121.png

 

 

I'm trying to sum the time spent across each task per hour (in mins) and display it simarly to below. 

 

chasuk19_1-1634145764410.png

Can anyone help please? (apologies if asked before, but i couldnt find anything relevant).

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @chasuk19 ,

 

You may try to create a Hours Table first and use CROSSJOIN() to merge two tables.

 

1.Hours Table

Hours = GENERATESERIES(1,24,1)

2. Merge tables:

New Table = 
FILTER (
    CROSSJOIN ( 'Table', 'Hours'),
    HOUR ('Table'[Start Time] ) <= 'Hours'[Hour of Day]
        && HOUR ('Table'[End Time] ) >= 'Hours'[Hour of Day]
)

3.Calculate the duration of each Hour:

duration in hour = 
IF (
    HOUR ( 'New Table'[Start Time] ) = HOUR ('New Table'[End Time] ),
    MINUTE ('New Table'[End Time] ) - MINUTE ('New Table'[Start Time] ),
    IF (
        HOUR (  'New Table'[Start Time] ) ='New Table'[Hour of Day],
        60 - MINUTE (  'New Table'[Start Time] ),
        IF ( HOUR ( 'New Table'[End Time] ) = 'New Table'[Hour of Day], MINUTE ( 'New Table'[End Time]), 60 )
    )
)

Below is the final output:

Eyelyn9_2-1634520572978.png

Eyelyn9_1-1634520377647.png

 

Best Regards,
Eyelyn 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

2 REPLIES 2
Anonymous
Not applicable

Hi @chasuk19 ,

 

You may try to create a Hours Table first and use CROSSJOIN() to merge two tables.

 

1.Hours Table

Hours = GENERATESERIES(1,24,1)

2. Merge tables:

New Table = 
FILTER (
    CROSSJOIN ( 'Table', 'Hours'),
    HOUR ('Table'[Start Time] ) <= 'Hours'[Hour of Day]
        && HOUR ('Table'[End Time] ) >= 'Hours'[Hour of Day]
)

3.Calculate the duration of each Hour:

duration in hour = 
IF (
    HOUR ( 'New Table'[Start Time] ) = HOUR ('New Table'[End Time] ),
    MINUTE ('New Table'[End Time] ) - MINUTE ('New Table'[Start Time] ),
    IF (
        HOUR (  'New Table'[Start Time] ) ='New Table'[Hour of Day],
        60 - MINUTE (  'New Table'[Start Time] ),
        IF ( HOUR ( 'New Table'[End Time] ) = 'New Table'[Hour of Day], MINUTE ( 'New Table'[End Time]), 60 )
    )
)

Below is the final output:

Eyelyn9_2-1634520572978.png

Eyelyn9_1-1634520377647.png

 

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

chasuk19
Frequent Visitor

After thinking about this more, I think the best way to achieve this is to 'split' out my data into a calculated table and represent the duration as minutes across each hour from each task, like the below. How would I be able to possibly achieve these?

chasuk19_5-1634206428949.png

 

 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors