Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
vijay4b4
Contributor III
Contributor III

Rank function doubt

Can anyone pls explain me this code?

If(Aggr( num( Rank( Sum(flag A) + Count(Transactions), 4,1)), Market)=5,1)

This is used as a calculated dimension.

 

Labels (4)
6 Replies
G3S
Creator III
Creator III

firstly, the value of (Sum of flag A + count of transactions) is being ranked.

Ranking is by lowest rank on first row (and in case multiple rows of same value then incremented +1 for each row) (the 4 in the expression gets this done)& Lowest rank is shown on all rows (the 1 in the expression) (my understanding is that this is for aggr purposes). (see the screenshot for example )

G3S_1-1679296003657.png

(Both Astrida + Betacab have 12 as the lowest value. The way rank expression is used here in the 3rd column  applies 1 (the red underlined part)  in both lines. If a 3rd customer has 12 as well, then the last column would show as 1-3 )

Once the ranking is done, it is being aggregated at ‘Market’ level.

If the result of this aggregation is 5, value returned is 1, else null.

 

see for rank:
https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/Relat...

vijay4b4
Contributor III
Contributor III
Author

Hi, thankyou so much. Now this is used as a calculated dimension in our table but calculated dimensions should be avoided to report this table in nprinting. So i am trying to find an alternative way to produce this. Can you pls help me out? Can this be used as a the measure?

G3S
Creator III
Creator III

hi, yes this calculation is a measure. 

vijay4b4
Contributor III
Contributor III
Author

Previously, it(Rank) is used as a calculated dimension and restrict dimension limits to show only first 1 value.

If i now use the same Rank as a measure, how can i restrict to show only first value?

 

vijay4b4
Contributor III
Contributor III
Author

Im trying to replace the Rank (calculated dimension) with same Rank(as a measure) so that the table can be used in NPrinting. 

G3S
Creator III
Creator III

Have you tried using the rank expression in the script? that may work