Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hppflpp
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:

Metrics:
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