Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

jim_chan
Contributor III

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

Tags (1)
1 Solution

Accepted Solutions
dimitar_angelov
New Contributor II

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

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

4 Replies

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

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
Contributor III

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

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
Valued Contributor II

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

Create variables for previous values and use in set anaylysis expression

dimitar_angelov
New Contributor II

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

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