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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Calculate the sum of times

Hi,

 

I hope you are able to help me.

I have to calculate the lack time during a production. This lacks are defined by an "EventID". The first numbers defines the type of the Event. The last defines if it is a Event-Start (1) or the Event-End (2). The StartDT column is my Date with Time. 

 

The column Line is only for better understanding.

 

My result for Event 1 should be the sum of

DATEDIFF ( StartDT (Line 1) ; StartDT (Line 2) ; SECONDS) = 12

DATEDIFF ( StartDT (Line 4) ; StartDT (Line 3) ; SECONDS) = 2

 

=> Lack Time for Event 1 = 14 seconds.

 

For Event 2 it is 12 seconds and for the Event of SerialNo R01190 and Event 3 it is 12 seconds.

 

StationIDStartDTModuleSerialNoEventID Line
12019-02-28 10:10:21003Q1002 1
12019-02-28 10:10:09003Q1001 2
12019-02-28 10:10:25003Q1002 3
12019-02-28 10:10:23003Q1001 4
12019-02-28 10:11:09003Q2001 5
12019-02-28 10:11:21003Q2002 6
12019-02-28 10:10:09R01193001 7
12019-02-28 10:10:21R011903002 8

 

Maybe someone has a solution.

 

Best regards

Timo

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

You will really struggle to get a good working solution if you load your data like this.  I suggest you watch my video to see how you can create time durations for each row.  Then you can just add the durations with SUM 

 

https://www.youtube.com/watch?v=xN2IRXQ2CvI

 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

1 REPLY 1
MattAllington
Community Champion
Community Champion

You will really struggle to get a good working solution if you load your data like this.  I suggest you watch my video to see how you can create time durations for each row.  Then you can just add the durations with SUM 

 

https://www.youtube.com/watch?v=xN2IRXQ2CvI

 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.