Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Raymzzz
Contributor III
Contributor III

Rank per group of dimension together with two other dimensions

Hi,

I'm struggling to show the correct ranking value within a specific dimension while showing also two other dimensions. See image.

je48746stijn_0-1751358757657.png

I've tried a lot of things but to no avail. The formula used for the column Rank in the table is 

=aggr(rank(count(RNB)), [Product Class])

 The formula used for the Column '# Items' is

=count(RNB)

 

What I want to achieve is this

Product ClassVolume BucketMaturity Bucket# ItemsRank
EUR AR1 : (0-25M)R4 : (5Y+)6251
EUR AR3 : (100M+)R1 : (0-1Y)4752
EUR AR2 : (25-100M)R1 : (0-1Y)4313
EUR AR1 : (0-25M)R1 : (0-1Y)3364
EUR AR2 : (25-100M)R4 : (5Y+)2845
EUR AR2 : (25-100M)R2 : (1-2Y)2326
EUR AR2 : (25-100M)R3 : (2-5Y)1457
EUR AR3 : (100M+)R2 : (1-2Y)868
EUR AR1 : (0-25M)R2 : (1-2Y)849
EUR AR1 : (0-25M)R3 : (2-5Y)7710
EUR AR3 : (100M+)R4 : (5Y+)5011
EUR AR3 : (100M+)R3 : (2-5Y)2912
EUR BR1 : (0-25M)R4 : (15Y+)4491
EUR BR1 : (0-25M)R2 : (5-10Y)4112
EUR BR1 : (0-25M)R3 : (10-15Y)2753
EUR BR2 : (25-100M)R1 : (0-5Y)2544
EUR BR1 : (0-25M)R1 : (0-5Y)2045
EUR BR2 : (25-100M)R2 : (5-10Y)1426
EUR BR3 : (100M+)R1 : (0-5Y)1057
EUR BR2 : (25-100M)R3 : (10-15Y)1048
EUR BR2 : (25-100M)R4 : (15Y+)649
EUR BR3 : (100M+)R2 : (5-10Y)2610
EUR BR3 : (100M+)R3 : (10-15Y)511
EUR BR3 : (100M+)R4 : (15Y+)112
EUR C-R1 : (0-6M)38701
EUR C-R2 : (6-12M)16612
EUR C-R3 : (12-18M)12363
EUR C-R4 : (18M+)3964
EUR D-R1 : (0-6M)2411
EUR D-R2 : (6-12M)1832
EUR D-R3 : (12-18M)73

 

I would be grateful if anybody has an idea how to solve this or why it is behaving as shown in the image above.

Many thank in advance.

Labels (3)
9 Replies
Chanty4u
MVP
MVP

Try this 

=Aggr(

    Rank(

        Count(RNB), 1 

    ),

    [Product Class],

    [Volume Bucket],

    [Maturity Bucket]

)

 

Or 

=Aggr(

    Rank(

        Count(RNB)

    ),

    [Product Class],

    [Volume Bucket],

    [Maturity Bucket]

)

 

Raymzzz
Contributor III
Contributor III
Author

Thanks, but no exactly what I want. Both formulas give this result :

Raymzzz_0-1751359891615.png

 

marcus_sommer

You may try something like:

=aggr(NODISTINCT rank(count(RNB)), [Product Class])
Raymzzz
Contributor III
Contributor III
Author

Thanks for your reaction Marcus, but result is not what I expect :

Raymzzz_0-1751372660722.png

 

marcus_sommer

The second dimension needs to be also added to the aggr(), like:

=aggr(NODISTINCT rank(count(RNB)), [Product Class], [Volume Bucket])
Raymzzz
Contributor III
Contributor III
Author

Not yet 😞 

Raymzzz_0-1751374119346.png

 

marcus_sommer

For me it's working and even a normal rank() without an aggr() returned the expected results. Are all dimensions native fields or are they calculated dimensions (should be avoided if any possible)?

marcus_sommer_0-1751376877081.png

 

 

Raymzzz
Contributor III
Contributor III
Author

Thanks, but I see only two dimensions in your example ?  I'm struggling with three or more dimensions per row. Thanks.

marcus_sommer

I think the rank-calculation worked it the same way also with more dimensions.

Therefore I assume that you aren't struggling the rank-results else with the (asc/desc) sorting within the view. If so it becomes difficult because it's a multi-dimensional sorting and the mix of dimensions and expression-results conflicts with each other respectively with the processing-order which doesn't support a n layer evaluation.

There are some workarounds available for such scenarios depending on the data-set and the object. One of them would be not to use a native field as dimension else a calculated dimension which includes the expressions-results. In your case the second dimension may look like:

aggr(dual([Volume Bucket], count(RNB)), [Product Class], [Volume Bucket])

and then sorting this dimension against it's numeric value.