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

Complex aggr

Hello -

I have this table:

place, salesperson-id, sale

A,111,40

A,222,30

A,333,90

B,444,56

B,555,124

B,666,50

B,777,300

B,888,300

C,999,400

C,101,300

C,202,420

C,303,390

D,404,14

D,505,30

D,606,12

D,707,20

I would like to create a chart with dimension- place,

and the expression will be the sum of the 2 highest values from sale ,

in this case it should look like this:

dimenssion, expression

A, 130

B, 600

C,820

D,50

I tried a lot with the functions AGGR and RANK

but I could not get the result .

Please if someone can help me I'd appreciate it very much thanks.

4 Replies
its_anandrjs

Try with

Dim1:- place

Dim2:- salesperson-id

Expr:- Aggr(if( Rank(sum(sale)) <= 2 ,sum(sale)),place, [salesperson-id])

lironbaram
Partner - Master III
Partner - Master III

hi

have a look at the attach example

i built a table with

place as dimension

and this expression : sum(aggr(if(rank(sale)<3,sale),place,[salesperson-id]))

its_anandrjs

Another one is

Dim1:- place

Expr:- Sum(Aggr(if( Rank(sum(sale)) <= 2 ,sum(sale)),place, [salesperson-id]))

dambeldor
Contributor III
Contributor III
Author

You are amazing!!!!!!!!!!!!!

well done for quick response and excellent answers .

it worked You saved me.

Thanks!!!!!!!!!!!!!!

is there any way to do it from the script for the Quality and speed information?