Working time: Excluding lunch break

Hi @DamianoDB,

​Welcome to the eazyBI community!

​The DateDiffWorkHours function presumes an uninterrupted business day and allows only one time interval to be provided as a function argument.
If you have two split time intervals, there are two options.

​1) calculate morning and afternoon shift times separately and then add them together
​2) calculate business hours during the day and then subtract business hours during the lunch break

​Both options return the same result.

​If you want to calculate the time until today for the still open issues, you might replace the empty “Closed at” with the Now() function.
​That will require some additional processing of results to handle potential data type mismatch.

Please see below the expression for the option of morning shift + afternoon shift with included handling of empty Closed date.

DateDiffWorkhours(
 [Issue].CurrentHierarchyMember.get('Created at'),
 TimestampToDate(
  CoalesceEmpty(
   DateToTimestamp([Issue].CurrentHierarchyMember.get('Closed at')),
   DateToTimestamp(Now()))),
 'default',
 '9-13')
+
DateDiffWorkhours(
 [Issue].CurrentHierarchyMember.get('Created at'),
 TimestampToDate(
  CoalesceEmpty(
   DateToTimestamp([Issue].CurrentHierarchyMember.get('Closed at')),
   DateToTimestamp(Now()))),
 'default',
 '14:30-18:30')


​Regards,
​Oskars / support@eazyBI.com