Skip to main content

Announcements
Week 5: Getting Answers With AI + A New Era of Data Governance - WATCH NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist

Number of hours

Dear all,

Need help for below calculations:

Date1(Day) Date1 Date2(Day) Date2 No.Hours Including weekend ( Fri, Sat) No.Hours excluding weekend(Fri, Sat) Network days
THU 25/05/2023 11:00:00 PM MON 28/05/2023 08:00:00 AM 57 9  
WED 24/05/2023 11:00:00 PM FRI 25/05/2023 11:00:00 PM 24    

 

Three measure to be calculated:

1) No. of hours between two dates including weekends

2) No. of hours between two dates excluding weekends.

3) Network days.

Note: Also need to make setting to consider first day of the week as SUNDAY and WEEKENDS days will be FRIDAY and SATURDAY.

 

Labels (1)
2 Replies
Chanty4u
MVP

For no of hours

1.

Interval(Timestamp(Date2) - Timestamp(Date1), 'hh')

 

2.

Interval(Timestamp(Date2) - Timestamp(Date1), 'hh') -

Interval(Floor((Timestamp(Date2) - Timestamp(Date1)) / (24*60*60)) * 24, 'hh')

 

3.

Networkdays(Date1, Date2, 'Sun', 'Fri')

 

Mahamed_Qlik
Specialist
Author

Let me give another example:

 

Date1 : 01/20/2023 06:58:50 PM ( Friday)

Date 2: 01/22/2023 09:21:20 AM ( Sunday)

Expected output should be 09:21:20 because Friday and Saturday are weekend and needs to be excluded hence remaining hours from the dat 01/22/2023 is 09:21:20


Hopefully clear this time