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

Row Number for Pivot Table

Hello,

I have a Pivot Table with the following data:

- Group/Customer are Dimensions

- Total is the Expression

Each Group can contain 1 or more Customers.

GroupCustomerTotal
A1AA1000
A1AB1500
A1AC1700
A1AD1800
A1AE1900
A1AF2500
A1AG3500
A1AH3300
B1BA1000
B1BB800
B1BC500
B1BD300
B1BE550
C1CA3000
C1CB5000
C1CD1000
D1DA100
D1DB200
D1DC300
E1EA1000
F1FA1500
G1GA250
H1HA5000
H1HB7000
H1HC8000

What I need is to create a Ranking with numbers from 1 to N (sorted by Total expression):

GroupTotalRanking
Total 52700
H1 200001
A1 172002
C1 90003
B1 31504
F1 15005
E1 10006
D1 6007
G1 2508

And then if I expand Group, I should see something like this (keeping the Ranking number for each Group):

GroupCustomerTotalRanking
Total 52700
H1Total 20000
HC80001
HB70001
HA50001
A1Total 17200
AG35002
AH33002
AF25002
AE19002
AD18002
AC17002
AB15002
AA10002
C1Total 9000
CB50003
CA30003
CD10003
B1Total 3150
BA10004
BB8004
BE5504
BC5004
BD3004
F1Total 1500
FA15005
E1Total 1000
EA10006
D1Total 600
DC3007
DB2007
DA1007
G1Total 250
GA2508


Is there any way to do that on my chart?

Thank you!

1 Solution

Accepted Solutions
devarasu07
Master II
Master II

Hi,

may be this?

Rank:

Aggr( NODISTINCT Rank(Sum( Total)),Group)

Total:

sum(Total)

Capture.JPG

View solution in original post

5 Replies
YoussefBelloum
Champion
Champion

Hi,

Try this on the ranking expression:

=aggr(NODISTINCT rank(sum(total),Group),Group)

devarasu07
Master II
Master II

Hi,

may be this?

Rank:

Aggr( NODISTINCT Rank(Sum( Total)),Group)

Total:

sum(Total)

Capture.JPG

microwin88x
Creator III
Creator III
Author

Thank you! It worked. The only thing is:

I have excluded Group = H1 like this: IF(Group<>'H1',Group) and then I've hidden Nulls.

When I have my Rank expression, it starts from 2, 3, 4, 5... (Because 1 would be H1)...

Is there any way to force it to start from 1?

Thanks again!

microwin88x
Creator III
Creator III
Author

Thank you! It worked. The only thing is:

I have excluded Group = H1 like this: IF(Group<>'H1',Group) and then I've hidden Nulls.

When I have my Rank expression, it starts from 2, 3, 4, 5... (Because 1 would be H1)...

Is there any way to force it to start from 1?

Thanks again!

antoniotiman
Master III
Master III

In this case Expressions :

Sum({<Group-={'H1'}>} Value)

and

Aggr(NODISTINCT Rank(TOTAL Sum({<Group-={'H1'}>} Value)),Group)