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

Generate weekend dates between two dates

Hi All,

i have a change request data for each change number  has a Start date and End date . iam actually trying to generate the weekend dates between start and end date for each change number where the weekend should be less than end date, im using below script , but its not working, please suggest me how to achieve the same.

GCIO_All_Dates_Temp:
LOAD [Change Number],
Date([Scheduled Start (UTC)]+iterno()-1) as Date

resident GCIO while [Scheduled Start (UTC)]+IterNo()-1 <=[Scheduled End (UTC)];

left join (GCIO_All_Dates_Temp)

Max_Date:
Load [Change Number],
Date(Max(Date)) as Max_Date
Resident GCIO_All_Dates_Temp group by [Change Number] ;


GCIO_All_Dates:
LOAD [Change Number],
Date,
WeekEnd(Date,0,0) as GCIO_Weekend_Date
Resident GCIO_All_Dates_Temp while WeekEnd(Date,0,0) < Max_Date ;

Drop Table GCIO_All_Dates_Temp;

 

Labels (2)
1 Solution

Accepted Solutions
edwin
Master II
Master II

tweak this to your requirements and see if it will work:

 

NoConcatenate
load * where match(Day,'Sat','Sun')>0;
load date(start+iterno()-1) as Dt, weekday(date(start+iterno()-1)) as Day
while date(start+iterno()-1) < end
;
load * inline [
start, end
5/1/2020, 10/4/2020
]

 

 

View solution in original post

2 Replies
edwin
Master II
Master II

tweak this to your requirements and see if it will work:

 

NoConcatenate
load * where match(Day,'Sat','Sun')>0;
load date(start+iterno()-1) as Dt, weekday(date(start+iterno()-1)) as Day
while date(start+iterno()-1) < end
;
load * inline [
start, end
5/1/2020, 10/4/2020
]

 

 

edwin
Master II
Master II

it will only give you weekends