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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to Calculate time saved with overlapping time

I'm having a devil of time to figure out how to calculate the time difference between one scan and multiple overlapping scans. See example below.


ProjectIdScanIdScanId.1StartedDateCompletedDateStartedDated.1CompletedDate.1SecondsSeconds2
100578/04/2021 12:05:16 PM8/04/2021 12:30:29 PM8/04/2021 12:04:45 PM8/04/2021 12:22:10 PM15131045
100598/04/2021 12:05:16 PM8/04/2021 12:30:29 PM8/04/2021 12:25:06 PM8/04/2021 12:50:30 PM15131524

 

  • ScanId is the "original" scan
  • ScanId.1 is the "overlapping" scan
  • The first set of date/time fields relate to the "original" scan
  • The second set of date/time fields relate to the "overlapping" scan
  • You can see they are both on the same ProjectId
  • Lastly Seconds is the duration of the "original" scan
  • and Seconds2 is the duration of the "overlapping" scan.

 

I want to calculate the saved time by having overlapping scans. Something like

(SUM Seconds2) - one row of the Seconds

2569 - 1513 = 1056 seconds (17.5 min) saved

 

If the scans ran serially the calculation would be

Seconds + Seconds2 + Seconds2
1513 + 1045 + 1524 = 4082 seconds (68 min)

 

Any assistance would be greatly appreciated

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Anonymous 

Since you want to perform these calculations per ProjectId, you can use a SUMX( VALUES(...), CALCULATE(...) ) type pattern:

 

Saved Time =
SUMX (
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) - MAX ( Projects[Seconds] ) )
)
Scan Time Serial = 
SUMX ( 
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) + MAX ( Projects[Seconds] ) )
)

 

MAX is just an arbitrary aggregation for Projects[Seconds], since presumably this column contains a single distinct value for a given ProjectId.

 

Do these give the result you expect?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

Hi @Anonymous 

Since you want to perform these calculations per ProjectId, you can use a SUMX( VALUES(...), CALCULATE(...) ) type pattern:

 

Saved Time =
SUMX (
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) - MAX ( Projects[Seconds] ) )
)
Scan Time Serial = 
SUMX ( 
    VALUES ( Projects[ProjectId] ),
    CALCULATE ( SUM ( Projects[Seconds2] ) + MAX ( Projects[Seconds] ) )
)

 

MAX is just an arbitrary aggregation for Projects[Seconds], since presumably this column contains a single distinct value for a given ProjectId.

 

Do these give the result you expect?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not applicable

Thank you Owen. Your suggestion worked as designed.

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.