Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

CITY Dimension wise TOP 5 Members(Dimension) Total

Dear All,

Below is the sample table and desire output what i am looking for. ( attached Excel and QVW for same)

Ex.

i have a sample table which have MEMBER, CITY AND TURNOVER.

SAMPLE TABLE

MEMBER CITY TURNOVER
ADELHI200
AMUMBAI100
BDELHI100
BMUMBAI300
BPUNE500
CDELHI50
CMUMBAI250
CPUNE600
DDELHI25
DMUMBAI50
DPUNE200
EDELHI225
EMUMBAI25
EPUNE125
FDELHI300
FMUMBAI110
FPUNE150

FIRST LEVEL OF OUTPUT: ( CITY wise TURNOVER of selected MEMBER)

MEMBER SELECTED : 'B'

OUTPUT:

CITY Sum(TURNOVER)
900
MUMBAI300
DELHI100
PUNE500

The above is very simple and easy. now i required a extra COLUMN Name "TOP 5 MEMBERS TURNOVER Like below:

Here i have selected MEMBER 'B' so SUM(TURNOVER) getting CITY wise SUM of TURNOVER of MEMBER 'B'

Now in the new COLUMN i want sum of TOP 5 MEMBERs of that CITY in the NEW Column.

CITY Sum(TURNOVER) TOP 5 Members Turnover
900
MUMBAI300
DELHI100
PUNE500

for example if i selected MEMBER 'B' the final output be like Below:

CITY Sum(TURNOVER) TOP 5 Members Turnover
900
MUMBAI300810
DELHI100875
PUNE5001575

810 in MUMBAI comes because top 5 Members TOTAL TURNOVER in MUMBAI City is 810. same go as for others city

I am adding you the sample QVW and Excel file for ready reference.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

=sum({1} aggr( if(rank(Sum({1}TURNOVER))<=5, Sum({1}TURNOVER)), CITY, MEMBER))

View solution in original post

3 Replies
swuehl
MVP
MVP

Try

=sum({1} aggr( if(rank(Sum({1}TURNOVER))<=5, Sum({1}TURNOVER)), CITY, MEMBER))

Not applicable
Author

Hi,

Thanks a Lot.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expression

=sum({1<CITY=P(CITY)>} aggr( if(rank(Sum({1}TURNOVER))<=5, Sum({1}TURNOVER)), CITY, MEMBER))

Regards,

Jagan.