Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Super-T
Contributor II
Contributor II

Set Analysis

Hi 

I am trying to create a rank for Max Year for Sales data.  I am using the following set analysis, but in returns 0 values in Sales column

 

Sum({$<[Calendar Year]={vMaxYear}>} Sales)

and this set analysis for Rank column

Rank(Aggr(Sum( {<vMaxYear>} Sales), [Customer])

 

vMaxYear returns 2024

Output

Rank                            Customer                                             Sales

1 ABC 0.00
2 DEF 0.00
3 ANT 0.00
4 BET 0.00
5 SALT 0.00
6 CATE 0.00
7 A OTHERS 0.00
8 COMBI 0.00
9 REVERSE 0.00
10 KILT 0.00
11 GENTLE 0.00
12 AXE 0.00
13 MANAGE A 0.00
14 NEW B 0.00
15 SCOTS 0.00
16 QUEEN 0.00
17 CANDY 0.00
18 PENS 0.00
19 WESTFIELDS 0.00
20 CHARLIE 0.00
21 CAN18 0.00
22 BRITNEY 0.00
23 VOLCANO 0.00
24 TRIMS 0.00
25 PREMS 0.00
26 MOSES 0.00
27 QUEENS 0.00
Labels (1)
5 Replies
mpc
Partner - Creator III
Partner - Creator III

Hi,

Can you try this syntax ?:

Sum({$<[Calendar Year]={"$(=vMaxYear)"}>} Sales)

Kind regards

Super-T
Contributor II
Contributor II
Author

Thanks for your response.  However it doesn't appear to have resolved the issue.

I replaced the variable with a fixed number '2024' and I am now receiving sales numbers instead of 0s.

My variable vMaxYear is set as Max([Calendar Year]), I am not sure why my expression is not recognising it.  Do you have any suggestions to help me with this please?

mpc
Partner - Creator III
Partner - Creator III

Ok, in the preview, this expression return Sum({$<[Calendar Year]={"2024"}>} Sales) ?
if yes, you need to upgrade the Rank with Rank(Aggr(Sum( {$<[Calendar Year]={"2024"} Sales), [Customer]) too

Super-T
Contributor II
Contributor II
Author

Thanks, however I would prefer to use the variable, is there something amiss with the syntax?  

mpc
Partner - Creator III
Partner - Creator III

My bad, Rank(Aggr(Sum( {$<[Calendar Year]={"$(=vMaxYear)"} Sales), [Customer])
In the data previeuw, you should see this expression: Rank(Aggr(Sum({$<[Calendar Year]={"2024"} Sales), [Customer]), is that ok ?