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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

latest 5 week in script

Dear All,

i need to calculates incremental for latest 5 week in script..

please reply soon

LOAD

  Distinct

  Week

From ABC where ?;

Present data is Week :201434,201435,201436,201437,201438,201439

Required data is Week : 201438,201439 only

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try like:

Temp:

Load

          Max(Week, 5) as LFifthWeek

From <>;

Let vWeek=Peek('LFifthWeek');

Drop Table Temp;

Final:

Load

          ...

          Week

From <> Where Week >=$(vWeek);

View solution in original post

3 Replies
tresesco
MVP
MVP

Try like:

Temp:

Load

          Max(Week, 5) as LFifthWeek

From <>;

Let vWeek=Peek('LFifthWeek');

Drop Table Temp;

Final:

Load

          ...

          Week

From <> Where Week >=$(vWeek);

Not applicable
Author

Hi

Try this

A:

Load Max(WeekNum) as Max;

Load *,Right(Week,2) as WeekNum Inline [

Week

201434

201435

201436

201437

201438

201439

];

Let vMax = Peek('Max',-1,A);

B:

Load * Inline [

Week

201434

201435

201436

201437

201438

201439

]

Where Right(Week,2)>=($(vMax)-1) and Right(Week,2)<=$(vMax);

Hope it helps you..

priyalshah9779
Contributor III
Contributor III

Hi Rahul

I have tried to make the solution , Let me know this is hat you are looking for

Thanks

Priyal