Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Getting the ID number from the last row saying: "Started"

Hey guys, I have a simple question:

SequenceStatusName
1StartedA
2StartedB
3Not StartedC
4Not StartedD

I want to create a field that says that the current position is "2" (last one started). I tried to use this:

IF(Status=PREVIOUS(Status),'',Sequence) as Current_Position.

The problem with that, is that also counts the headers, so, number "1" always come in this field, and I don't want that, i want simply to show "number 2".

How can I do that?

Thanks

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You could so this after loading the data in your post:

MaxValues:

LOAD Max(Sequence) As LastStart

     'Started' As Status

RESIDENT Data WHERE Status = 'Started';

To get that into a variable, use Peek()

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You could so this after loading the data in your post:

MaxValues:

LOAD Max(Sequence) As LastStart

     'Started' As Status

RESIDENT Data WHERE Status = 'Started';

To get that into a variable, use Peek()

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Thanks it did work well! I would like to get also the number of the last item in the table. how do I do that?

Nicole-Smith

Something like this should do the trick:

LET vLastItem = PEEK('FieldName', NoOfRows('TableName')-1, 'TableName');