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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Applicable88
Impactful Individual
Impactful Individual

Calculated column where the duration between start- and finish time not in the same row

Hello,

I have machine data here. Almost all missions contains several actions. But I want the total duration of a specific mission. How to create a calculated column where I get the total duration of a mission. 

My sample table is like this. The last columns "TotalTime" is my wanted outcome. If its not possible to get the duration in HH:MM:SS then seconds will do the same. I can convert it later on:

MissionNumberActionNameDate Starttime Finishtime TotalTime
1Start of Action28.07.2021 28.07.2021 08:00:00 28.07.2021 08:01:00 00:10:00
1Moving28.07.2021 28.07.2021 08:01:00 28.07.2021 08:05:00 00:10:00
1Delivering28.07.2021 28.07.2021 08:05:00 28.07.2021 08:09:00 00:10:00
1Finish of Action28.07.2021 28.07.2021 08:09:00 28.07.2021 08:10:00 00:10:00
2Start of Action28.07.2021 28.07.2021 09:00:00 28.07.2021 09:02:00 00:18:00
2Moving28.07.2021 28.07.2021 09:02:00 28.07.2021 09:09:00 00:18:00
2Delivering28.07.2021 28.07.2021 09:09:00 28.07.2021 09:15:00

 

 

00:18:00
2Finish of Action28.07.2021 28.07.2021 09:15:00 28.07.2021 09:18:00 

00:18:00

 

For example MissionNumber 1 has a total duration of 10 Minutes. Which is the difference between the first action of that mission and the finish time of the last action of that very mission.

Thank you very much in advance.

Best. 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Duration = 
VAR __t = FILTER( INFO, INFO[MissionNumber] = EARLIER( INFO[MissionNumber] ) )
RETURN
    MAXX( __t, INFO[Finishtime] ) - MINX( __t, INFO[Starttime] )

Screenshot 2021-07-28 114748.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

1 REPLY 1
CNENFRNL
Community Champion
Community Champion

Duration = 
VAR __t = FILTER( INFO, INFO[MissionNumber] = EARLIER( INFO[MissionNumber] ) )
RETURN
    MAXX( __t, INFO[Finishtime] ) - MINX( __t, INFO[Starttime] )

Screenshot 2021-07-28 114748.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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