Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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 - Specialist II
Partner - Specialist II

Hi,

Can you try this syntax ?:

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

Kind regards

From Next Decision and mpc with love
It helps, like it, It solves, mark it
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 - Specialist II
Partner - Specialist II

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

From Next Decision and mpc with love
It helps, like it, It solves, mark it
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 - Specialist II
Partner - Specialist II

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 ?

From Next Decision and mpc with love
It helps, like it, It solves, mark it