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

Date Difference and Ignore the Sunday Dates

Hi All,

How to find out the difference between the two dates and Based on the Result how to eliminate Sunday Dates.
For your reference i have attached the test file.
Please help me get the output.

Thanks,

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

set your Date & Timestamp format in script according to actual format in Data

SET DateFormat='MM/DD/YYYY';
SET TimestampFormat='MM/DD/YYYY hh:mm';

 

Now you can use below in script or in front

=CEIL(Interval(floor(Date1)-floor(Date2),'dd') -  Div(floor(Date1)-floor(Date2),7) + (weekday(floor(Date2)) > WeekDay(floor(Date1)))) 

 

Based on your requirement ,if you want to keep current day also in count, you can either add or subtract 1 in above expression

View solution in original post

3 Replies
Taoufiq_Zarra

Hi,

Please check the attached Qlikview file.

the formulas are :

Date Difference between Date1 and Date 2 :

=floor((Date1-Date2)+1)

 

Working Days Between Date1 and Date2 :

=networkdays(Date2,Date1)

 

Date Difference Ignore the Sunday :

=(floor((Date1-Date2)+1)-if(num(WeekDay(Date1))=6,floor((WeekEnd(Date1) - WeekStart(Date2)+1) / 7),floor((WeekEnd(Date1) - WeekStart(Date2)+1) / 7)-1))

 

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

Do you want to achieve it in front end or script?

Kushal_Chawda

set your Date & Timestamp format in script according to actual format in Data

SET DateFormat='MM/DD/YYYY';
SET TimestampFormat='MM/DD/YYYY hh:mm';

 

Now you can use below in script or in front

=CEIL(Interval(floor(Date1)-floor(Date2),'dd') -  Div(floor(Date1)-floor(Date2),7) + (weekday(floor(Date2)) > WeekDay(floor(Date1)))) 

 

Based on your requirement ,if you want to keep current day also in count, you can either add or subtract 1 in above expression