Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Help with Set analysis

Hi,

My requirement is to get records of previous year when a particulat year is selected .

Sum of Sales

For the same,  I have written the following code

sum({<CurrYear={$(=CurrYear-1)} >}Sales).

So if Curryear is selected as 2015 then i should sum up 2014 records. The formula is working fine when a particular year is selected.

BUt I have a chart where my Curryear is the dimension and my above formula is failing and returning 0.

Chart is Bar chart and the dimension is Curryear (2013,2014,2015, etc). For all years it is showing as 0

Can any one help on this problem? I think we need to change the set analysis, CurrYear = ???

BR,

Neehu

1 Solution

Accepted Solutions

Re: Help with Set analysis

The set of a set analysis expression is calculated at the chart level, not at the row level. That's why your expression doesn't work with Curryear as dimension unless you select only one value in the Curryear dimension. You can try one of the approaches described in this document: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
2 Replies

Re: Help with Set analysis

The set of a set analysis expression is calculated at the chart level, not at the row level. That's why your expression doesn't work with Curryear as dimension unless you select only one value in the Curryear dimension. You can try one of the approaches described in this document: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
MVP
MVP

Re: Help with Set analysis

You cannot use a set expression like that. The set expression is calculated once for the chart/table and has no knowledge of the dimension values.

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