Hello @arees,
Thank You for posting your query onto the Forum.
In order to deduct Break Times from the Time Stamps. Firstly, you need to convert them into the intervals i.e., Start Time and End Time.
That is, from this -
To this -
Once data is transformed into Start and End time intervals, then you need to write the below provided DAX measure to achieve the results -
Total Minutes (Exc. Break Times) =
SUMX(
ADDCOLUMNS(
SUMMARIZE(
Data ,
Data[EmployeeID] ,
Data[Date] ,
Data[Start Time] ,
Data[End Time] ) ,
"@Total_Minutes" ,
SWITCH( TRUE() ,
TIME( 9 , 0 , 0 ) >= Data[Start Time] &&
TIME( 9 , 15 , 0 ) <= Data[End Time] ,
DATEDIFF( Data[Start Time] , Data[End Time] , MINUTE ) - 15 ,
TIME( 12 , 0 , 0 ) >= Data[Start Time] &&
TIME( 12 , 30 , 0 ) <= Data[End Time] ,
DATEDIFF( Data[Start Time] , Data[End Time] , MINUTE ) - 30 ,
TIME( 15 , 0 , 0 ) >= Data[Start Time] &&
TIME( 15 , 15 , 0 ) <= Data[End Time] ,
DATEDIFF( Data[Start Time] , Data[End Time] , MINUTE ) - 15 ,
DATEDIFF( Data[Start Time] , Data[End Time] , MINUTE ) ) ) ,
[@Total_Minutes] )
I’m also attaching the working of the PBIX file for the reference purposes. Please go through the steps applied in the Power Query to review them.
Hoping you find this useful and meets your requirements that you’ve been looking for.
Thanks and Warm Regards,
Harsh
Deducting Break Times From Time Stamps - Harsh.pbix (22.8 KB)