Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

Where Statement

Hi,

I am trying to do where statement as follow but it I am getting error.

ID

1

2

3

4

Load ID

Where ID>LastValue(ID)-2;

Anybody can help?

Thxs

1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like this

Test1:

Load * Inline

[

ID

1

2

3

4

];

LET vMax =  peek('ID', RowNo(TOTAL)-1, 'Test1');

Test:

NoConcatenate

Load * Resident Test1 where ID > '$(vMax)'-2;

Drop Table Test1;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

8 Replies
alec1982
Specialist II
Specialist II
Author

Wish someone can help on this one

Thxs,

Alec

Anonymous
Not applicable

Badr

Try     

     Where ID>peek(ID)-2;

If I have misunderstood what you wish to do then please explain your requirement.

Best Regards,     Bill Markham

danielact
Partner - Creator III
Partner - Creator III

I believe LastValue needs to have a Group clause in the load script.

Bill was correct except for one thing - you need quotes in the peek function. It would be this:

Where ID>peek('ID')-2;

alec1982
Specialist II
Specialist II
Author

Hi Guys,

Thanks for the help but I am getting no data as result.

My result table should look like

ID

3

4

Any thoughts?

Anonymous
Not applicable

Badr

I hope understand what you are after now, try this :

Where ID > previous(previous(ID))

I tested it with this :

TempTable:

LOAD * INLINE [

  ID

  1

  2

  3

  4

];

noconcatenate

Table:

Load

ID

resident TempTable

Where ID > previous(previous(ID))

;

drop table TempTable ;

Best Regards,     Bill

MayilVahanan

Hi

Try like this

Test1:

Load * Inline

[

ID

1

2

3

4

];

LET vMax =  peek('ID', RowNo(TOTAL)-1, 'Test1');

Test:

NoConcatenate

Load * Resident Test1 where ID > '$(vMax)'-2;

Drop Table Test1;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
alec1982
Specialist II
Specialist II
Author

Hi,

this returned

ID

2

3

4

Thxs,

Alec

alec1982
Specialist II
Specialist II
Author

Thank you!