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! Request now

Reply
PowerAutomater
Helper IV
Helper IV

How to get the total of a duration?

I have a data source containing events that took place, when they took place (some events took place on multiple dates), and the duration of the event, so something like this:

Event NameDateDuration (hrs)
Event 11/1/20251
Event 21/1/20250.5
Event 12/1/20251
Event 33/1/20253
Event 44/1/20252
Event 25/1/20250.5
Event 52/1/20254

 

I would like to do a line chart showing the total duration spent on events at a given point in time so essentially totalling the duration. So far I have the Date on the Y axis and the Duration on the X axis. What I'm not sure on is whether to do a sum of the duration or a count or something else to get the right total?

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @PowerAutomater 

The type of calculation you need depends on what you're trying to show in the chart.

If your goal is to show how many hours of events occurred on each date, then a simple sum of the Duration column grouped by Date is appropriate.

Example DAX measure:

Total Duration Per Day = SUM('Table'[Duration (hrs)])


Use this measure with Date on the X-axis and the measure on the Y-axis.

If you're trying to show how the total event time accumulates over time (running total), you can use a cumulative sum:

Cumulative Duration = 
CALCULATE(
[Total Duration Per Day],
FILTER(
ALLSELECTED('Table'[Date]),
'Table'[Date] <= MAX('Table'[Date])
)
)


Note: You can group the data by date only to get the total duration per day, or by both date and event name if you want to show the duration per event per day.

Ritaf1983_0-1753249688747.png

 

Avoid using COUNT unless you're interested in counting how many events occurred, which is different from measuring time.

The pbix with the example is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Ritaf1983
Super User
Super User

Hi @PowerAutomater 

The type of calculation you need depends on what you're trying to show in the chart.

If your goal is to show how many hours of events occurred on each date, then a simple sum of the Duration column grouped by Date is appropriate.

Example DAX measure:

Total Duration Per Day = SUM('Table'[Duration (hrs)])


Use this measure with Date on the X-axis and the measure on the Y-axis.

If you're trying to show how the total event time accumulates over time (running total), you can use a cumulative sum:

Cumulative Duration = 
CALCULATE(
[Total Duration Per Day],
FILTER(
ALLSELECTED('Table'[Date]),
'Table'[Date] <= MAX('Table'[Date])
)
)


Note: You can group the data by date only to get the total duration per day, or by both date and event name if you want to show the duration per event per day.

Ritaf1983_0-1753249688747.png

 

Avoid using COUNT unless you're interested in counting how many events occurred, which is different from measuring time.

The pbix with the example is attached

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

It was the first one I was looking for, thank you

rajendraongole1
Super User
Super User

Hi @PowerAutomater  - create a measure for running total line as below: 

Cumulative Duration =
CALCULATE(
SUM('Events'[Duration]),
FILTER(
ALL('Events'[Date]),
'Events'[Date] <= MAX('Events'[Date])
)
)

 

This works. please check





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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