Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with aggr(rank

I am having a problem with the aggr(rank feature.  I get different results when I change the ranking number.  By different results, I get companies that were not shown before in ranks above the initial limit.  The totals are different also.

DIMENSION
=if(
aggr(
rank(
Sum ({$<[Region] = {'A','B','C','D','E','F'}>} [Counter]))
  , [SNL Company Name])<=25
  , [SNL Company Name],'All Other')

EXPRESSIONS

Rank
=rank(
Sum ( {$<[Region] = {'A','B','C','D','E','F'},
[As of Year] = {$(=Year(Max(AddMonths([As of Date],0))))},
[As of Day] = {$(=Day(MonthEnd(Max(AddMonths([As of Date],0)))))},
[As of Month] = {$(=Month(Max(AddMonths([As of Date],0))))}>} [Counter]),2)

Count Dec 2013
Sum ( {$<[Region] = {'A','B','C','D','E','F'},
[As of Year] = {$(=Year(Max(AddMonths([As of Date],0))))},
[As of Day] = {$(=Day(MonthEnd(Max(AddMonths([As of Date],0)))))},
[As of Month] = {$(=Month(Max(AddMonths([As of Date],0))))}>} [Counter])

Count Sep 2013
Sum ( {$<[Region] = {'A','B','C','D','E','F'},
[As of Year] = {$(=Year(Max(AddMonths([As of Date],-3))))},
[As of Day] = {$(=Day(MonthEnd(Max(AddMonths([As of Date],-3)))))},
[As of Month] = {$(=Month(Max(AddMonths([As of Date],-3))))}>} [Counter])

Results

[SNL Company Name])<=25                           [SNL Company Name])<=50

RankCount for Dec
  2013
Count for Sep
  2013
RankCount for Dec
  2013
Count for Sep
  2013
1794667830215398352879
2191781928121917819281
3157611561931576115619
472847149472847149
559975922559975922
653015066653015066
745224546745224546
834333537834333537
930123141930123141
10291628551029162855
11275925201127592520
12275527151227552715
13254725981325472598
14254126441425412644
15248824321524882432
16243823501624382350
17222921891722292189
1819291603
18184018811918401881
19183617642018361764
20164516002116451600
21160116492216011649
2315101364
2415011414
2514781394
22143614142614361414
23141515002714151500
24129515102812951510
2912921296
3012821315
3112521347
25121513003212151300
3311451128
3410961022
3510611172
36995936
379901015
38987990
39912952
40896871
268891109418891109
42876850
43812798
44783868
45668674
46661685
47613655
48612795
49600570
50468673
-177799176593-176735175557


1 Reply
MK_QSL
MVP
MVP

Are you considering Calculation from Max Date?

If yes, use as below..

Instead of  Max(AddMonths([As of Date]))

use AddMonths(Max([As of Date]))


Do the same for all your expressions.