Skip to main content
Applications are open for the 2024 Qlik Luminary Program. Apply by December 15 here.
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Year selection in dynamic (pivot) tables in Qlik Sense

Hi guys,

I created a dynamic table and a dynamic pivot table with Qlik Sense as introduced by Patric Nordström (Top 10 Viz tricks) in which my users can select certain dimensions and metrics in order to create their own tables within an app published by myself. 

I'd like them to compare sales data from this year to sales data from last year, though.

I have a list of dimensions, including StatYear that contains the statistical year.

The following metric works:

Load * INLINE [
Metric, MetricNo, MetricFormula
Sales, 1, "num(Sum(Sales), '#.##0; -#.##0')"

I tried to include

Sales previous year, 2, "num(sum({$<StatYear={$(=max(StatYear)-1)}>}Sales), '#.##0; -#.##0')"

but it seems like the function that works perfectly fine for diagrams can't be used in the script. Do you have any advice?

Thanks in advance.

Labels (2)
0 Replies