Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to get continuous date

hi

i tried a lot but can't get success

plzz help me through out of it

my sample table is this

dateAbsent
1/1/2013A
1/2/2013A
1/5/2013A
1/7/2013A
1/8/2013A
1/9/2013A
1/12/2013A
1/13/2013A
1/18/2013A

i have input box with variable

when

INPUTBOX_---

OUTPUT
variable2
dateAbsent



1/1/2013A



1/2/2013A



1/7/2013A



1/8/2013A



1/9/2013A



1/12/2013A



1/13/2013A

when

INPUTBOX_---
variable3
OUTPUT
dateAbsent
1/7/2013A
1/8/2013A
1/9/2013A

plzzzzz help me your help will be appreciated.

thnx in advance

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

This is the script:

// load the data and create a field ConsecFlag. If the date is one day

// later than the previous date then ConsecFlag is 1 + the value of

// ConsecFlag of the previous record. Otherwise it is 1.

T1:

load *, if(previous(date)=date-1,rangesum(1, peek(ConsecFlag)),1) as ConsecFlag;

LOAD date#(date,'MM/DD/YYYY') as date, Absent INLINE [

    date, Absent

    1/1/2013, A

    1/2/2013, A

    1/5/2013, A

    1/7/2013, A

    1/8/2013, A

    1/9/2013, A

    1/12/2013, A

    1/13/2013, A

    1/18/2013, A

];

// Order the table by date desc and check if the value of ConsecFlag

// is smaller than the value of ConsecFlag of the previous record. If it

// isn't then use ConsecFlag. If it isn't use the value stored in the

// previous record of the target table T2.

T2:

NoConcatenate

load date, Absent,

if(ConsecFlag<previous(ConsecFlag),peek(ConsecFlag),ConsecFlag) as ConsecFlag

Resident T1 order by Absent, date desc;

drop table T1;

In the UI I added an inputbox that changes the value of a variable named vLength. There's also a straight table with date and Absent as dimensions and as expression sum({<ConsecFlag={'>=$(vLength)'}>}1). This expression is hidden so it doesn't show in the table.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Not applicable
Author

plz helppppp me

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

hiiiii   Gysbert Wassenaar

thnx for reply. m using personal edition so, can't open your application

plzz  explain briefly

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

This is the script:

// load the data and create a field ConsecFlag. If the date is one day

// later than the previous date then ConsecFlag is 1 + the value of

// ConsecFlag of the previous record. Otherwise it is 1.

T1:

load *, if(previous(date)=date-1,rangesum(1, peek(ConsecFlag)),1) as ConsecFlag;

LOAD date#(date,'MM/DD/YYYY') as date, Absent INLINE [

    date, Absent

    1/1/2013, A

    1/2/2013, A

    1/5/2013, A

    1/7/2013, A

    1/8/2013, A

    1/9/2013, A

    1/12/2013, A

    1/13/2013, A

    1/18/2013, A

];

// Order the table by date desc and check if the value of ConsecFlag

// is smaller than the value of ConsecFlag of the previous record. If it

// isn't then use ConsecFlag. If it isn't use the value stored in the

// previous record of the target table T2.

T2:

NoConcatenate

load date, Absent,

if(ConsecFlag<previous(ConsecFlag),peek(ConsecFlag),ConsecFlag) as ConsecFlag

Resident T1 order by Absent, date desc;

drop table T1;

In the UI I added an inputbox that changes the value of a variable named vLength. There's also a straight table with date and Absent as dimensions and as expression sum({<ConsecFlag={'>=$(vLength)'}>}1). This expression is hidden so it doesn't show in the table.


talk is cheap, supply exceeds demand