Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
tiateng1
Contributor
Contributor

Using set analysis to get a value of previous period

Hi. I have a dataset with the fields: Account_id, account_score, year_quarter, YearQuarterKey (which is a running sequencial number for every year-quarter combination). I want to use set analysis in a table presentation on my app, and to add the field previous_quarter_score to every row ! in the table, according the field YearQuarterKey

I tried:

=max( {< YearQuarterKey = {"$(=(YearQuarterKey-1))"} >} account_score)

It did not work.

Any thoughts on how to accomplish this?

Thanks

Labels (1)
1 Reply
marcus_sommer

It's not possible in this way - for two reasons.

At first the $-sign expansion creates an adhoc-variable which is evaluated ones before the chart is calculated and then applied for each row - and even without it a set analysis worked like a selection which means that the condition worked on a column-level and not a row-level respectively the chart-dimensionality couldn't be queried with it (this would require an if-loop).

The second reason is that the dimension.values doesn't match because the data of the previous period doesn't belong to those of the current period.

Of course, with pure force each result could be shown against any dimension-value but the complexity increased massive and it will have serious disadvantages in the usability and further the performance will decrease quite significantly.

Alternative approaches for such use-case are the use of interrecord-functions like above() or the implementation of an overlapping dimensionality, for example per: The As-Of Table - Qlik Community - 1466130.