Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
blurrblurr
Contributor III
Contributor III

Interval time to remove Weekend days with networkdays

Hi there,

blurrblurr_0-1623816374399.png

I have these 2 dates 04 Jun 2021 is a Friday while 05 Jun 2021 is a Sat

I use Interval(DATE_END - DATE_START,'DD hh:mm:ss' ) 

blurrblurr_1-1623816554018.png

I get the time difference 06:16:15

But I need to remove the Weekend time starting from 05 Jun 2021 00:00:00 so the expected result is 

the difference between 04 Jun 23:47:35 to 05 Jun 00:00:00

I search the entire community chat and tried the script below as I think is more suitable.

Interval(DATE_END - DATE_START,'DD hh:mm:ss' ) - NetWorkDays(DATE_START,DATE_END )

blurrblurr_2-1623816805413.png

But it gave me a negative value. I tried many ways to but I am not getting anything close.

is there any solution for is?

Expected result shall be formatted to DD hh:mm:ss

 

 

 

6 Replies
yassinemhadhbi
Creator II
Creator II

Good morning 

I Recomend that you put a condition , if end date is sat then 05/06/2021 00:00:00

If(num(weekday(DateEnd))=5,date(DateEnd,'DD/MM/YYYY 00:00:00'),DateEnd)

Best Regards
Yassine Mhadhbi
blurrblurr
Contributor III
Contributor III
Author

But how shall I use it?

yassinemhadhbi
Creator II
Creator II

Can you share sample of your qvw please

Best Regards
Yassine Mhadhbi
blurrblurr
Contributor III
Contributor III
Author

I only have access to data load editor and it look something like this

LOAD
DATE_START,
DATE_END
FROM [lib://WorkingENV/TEST/DATA.qvd]

yassinemhadhbi
Creator II
Creator II

LOAD
DATE_START,
If(NUM(WEEKDAY(DATEEND))=5,date(DATEND,'DD/MM/YYYY 00:00:00'),DATEND)
FROM [lib://WorkingENV/TEST/DATA.qvd]

Best Regards
Yassine Mhadhbi
blurrblurr
Contributor III
Contributor III
Author

I tried, but I have another scenario that I need to remove start date and time on Weekend. so I use another conditon for start weekend?

is there a simpler solution like I convert networkdays to DD HHMMSS?