Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
vsr_shimla
Contributor II
Contributor II

How to get dynamic end of period in load script

Dear All,

How do I calculate the end dates via load script,Pls help.

I tried Keep & Previous but  the result starts in PeriodNumber2  

 

Type:
LOAD PeriodStart-1 as PeriodEnd,

* INLINE [
PeriodNumber,PeriodStart
1,2013-01-01
2,2013-01-28
3,2013-02-25
4,2013-04-01
5,2013-04-29
6,2013-05-27
7,2013-07-01
8,2013-07-29
9,2013-08-26
10,2013-09-30
11,2013-10-28
12,2013-11-25

2 Solutions

Accepted Solutions
Vegar
MVP
MVP

 

 

SourceData:

LOAD * INLINE [

PeriodNumber,PeriodStart
1,2013-01-01
2,2013-01-28
3,2013-02-25
4,2013-04-01
5,2013-04-29
6,2013-05-27
7,2013-07-01
8,2013-07-29
9,2013-08-26
10,2013-09-30
11,2013-10-28
12,2013-11-25];

 

 

Type:

Load *,

Alt(peek('PeriodStart'), today()) as periodend

Resident SourceData

Order by Period desc;

Drop table SourceData;

View solution in original post

vsr_shimla
Contributor II
Contributor II
Author

Thanks,Problem solved.

 

View solution in original post

3 Replies
Vegar
MVP
MVP

 

 

SourceData:

LOAD * INLINE [

PeriodNumber,PeriodStart
1,2013-01-01
2,2013-01-28
3,2013-02-25
4,2013-04-01
5,2013-04-29
6,2013-05-27
7,2013-07-01
8,2013-07-29
9,2013-08-26
10,2013-09-30
11,2013-10-28
12,2013-11-25];

 

 

Type:

Load *,

Alt(peek('PeriodStart'), today()) as periodend

Resident SourceData

Order by Period desc;

Drop table SourceData;

vsr_shimla
Contributor II
Contributor II
Author

Thanks,Problem solved.

 

Vegar
MVP
MVP

Great, I'm happy to hear that.
- Vegar