Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
fdelacal
Specialist
Specialist

help with date

i have fiedl date_ini that look like

11/11/2007

26/11/2007

28/11/2007

21/03/2008

26/11/2008

16/01/2009

26/11/2009

30/07/2013

now i need do te finish day for this dates

example

start date      finish day

11/11/2007     25/11/2007                      26/11/2007 - 1

26/11/2007     27/11/2007                      28/11/2007

28/11/2007     20/03/2008                      21/03/2008

21/03/2008     25/11/2008                      26/11/2008

i need do that in script for late do a intervalmatch with other date field.

Thanks

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

DATA:

Load Date(Date#(STARTDATE,'DD/MM/YYYY')-1) as EndDate,Previous(Date(Date#(STARTDATE,'DD/MM/YYYY'))) as StartDate inline [

STARTDATE

11/11/2007

26/11/2007

28/11/2007

21/03/2008

26/11/2008

16/01/2009

26/11/2009

30/07/2013

];

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
fdelacal
Specialist
Specialist
Author

original data

DATE             QT

11/11/2007      7

26/11/2007      1

28/11/2007      1

21/03/2008      8

26/11/2008      30

16/01/2009      8

26/11/2009      6

11/07/2013      3

RESULT with your suggest.

STARTDATE      ENDDATE      QTSTOCK

26/11/2007      10/11/2007      7

28/11/2007      25/11/2007      1

21/03/2008      27/11/2007      1

26/11/2008      20/03/2008      8

16/01/2009      25/11/2008      30

26/11/2009      15/01/2009      8

11/07/2013      25/11/2009      6

10/07/2013                          3

shoul be..

STARTDATE  ENDDATE      QTSTOCK

11/11/2007     25/11/2007       7          

26/11/2007     27/11/2007       1   

28/11/2007     20/03/2008       1           

21/03/2008     25/11/2008      8         

 

thanks

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Load Date(Date#(DATE,'DD/MM/YYYY')-1) as EDATE,Date(Date#(Previous(DATE),'DD/MM/YYYY')) as SDATE,QT inline [

DATE,             QT

11/11/2007,      7

26/11/2007,      1

28/11/2007,      1

21/03/2008,      8

26/11/2008,      30

16/01/2009,      8

26/11/2009,      6

11/07/2013,      3

] where not isnull(Date(Date#(Previous(DATE),'DD/MM/YYYY')));

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!