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: 
jim_chan
Specialist
Specialist

Set analysis in straight table, how to display out previous record/value?

Hi guys,

I am creating a straight table to display previous and current value. i am plannign to write in the fron end. but how to write in set analysis? any example?

For exmaple: I want to display out a ranking of an item - current is Rank1, previous is rank 5. So, i need to create an expression to display the previous value.

Rgds,

Jim

1 Solution

Accepted Solutions
dimitar_angelov
Partner - Contributor II
Partner - Contributor II

Hi Jim,


I am newbie but here is what I did for you:

max({<Year={$(vThisYear)}>}Rank)

max({<Year={$(vPreviousYear)}>}Rank)

Note: use min() or max() depending on your ranking system (if its ascending or descending)


vThisYear=max(Year)

vPreviousYear=max(Year-1)

You will get a table like this:

Ranking.jpg

Hope this helps.

Regards,

Dimitar

View solution in original post

4 Replies
robert_mika
Master III
Master III

What do you mean by previous?

Has the value change since the data been re-loaded?

or the values have some condition that make the rank  so they already exist in the current dataset.

Feeling Qlikngry?

How To /Missing Manual(25 articles)

QlikSteps - Blog

jim_chan
Specialist
Specialist
Author

Yes. it been reloaded. For instance.

Year 2015 data - record ID 123456. is rank 7

Year 2016 data - record ID 123456, ir rank 8

So, i want to create a straight table to display the record id , and its current rank(rank8) and previous rank(rank7).

vardhancse
Specialist III
Specialist III

Create variables for previous values and use in set anaylysis expression

dimitar_angelov
Partner - Contributor II
Partner - Contributor II

Hi Jim,


I am newbie but here is what I did for you:

max({<Year={$(vThisYear)}>}Rank)

max({<Year={$(vPreviousYear)}>}Rank)

Note: use min() or max() depending on your ranking system (if its ascending or descending)


vThisYear=max(Year)

vPreviousYear=max(Year-1)

You will get a table like this:

Ranking.jpg

Hope this helps.

Regards,

Dimitar