Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
sijojoseph22
Creator II
Creator II

Aggr/Rank Function query

Hi All,

We are  having the below data (sample )

   

Quote ReferenceUMRSub COBInsuredAmount
Q1UMR1Off-shoreCOMPANY1137555.6
Q2UMR2Off-shoreCOMPANY2250019.2
Q3UMR3Off-shoreCOMPANY3105113.1
Q4UMR3Off-shoreCOMPANY219775.59
Q1UMR3

Off-shore

COMPANY3105019.2

We need to derive the Max Amount and Average Amount group by UMR and Insured and the records will look like the below.

   

Max Insured (the Insured having the hight amount by grouping UMR and Insured)Avg Line SizeMAX
COMPANY3154370.7210132.3

Calculation given below

   

InsuredUMRAmount by UMR and Insured
COMPANY1UMR1 137,556
COMPANY2UMR2 250,019
COMPANY2UMR3 19,776
COMPANY3UMR3 210,132 Highest

 

Attached the qvw with sample data.

 

Thanks,

Sijo

1 Solution

Accepted Solutions
sunny_talwar

Check this out:

Capture.PNG

Expressions:

Avg: =If(Max > 0, Avg(TOTAL Aggr(Sum(Amount), UMR, Insured)))

Max: =Sum(If(Aggr(Sum(Amount), Insured, UMR) = Max(TOTAL Aggr(Sum(Amount), Insured, UMR)), Amount))

View solution in original post

8 Replies
Anonymous
Not applicable

try this as a expression?

=max(aggr(sum(Amount), UMR))

or

=aggr(avg(Amount), UMR)

Anonymous
Not applicable

What you want to do with Rank()?

check this?

Top 5 analysis using Rank fuction

sunny_talwar

How is 210,132 bigger than 250,019?? Not sure I understand what you are trying to achieve

Anonymous
Not applicable

you taken the straight table

Try this expression in expression

aggr(avg(Amount),UMR)

avinashelite

//Achieving using script

Temp:

LOAD [Quote Reference],

UMR,

[Sub COB],

Insured,

Amount

from

tablename;

result:

LOAD Insured,

sum(Amount) as Sum_Amount,

Avg(Amount) as Avg_amont

resident

Temp

Group by Insured;

In the front end add the Insured, Sum_Amount and Avg_amont to straight table and then

go to chart properties > dimension limits >select the  Sum_Amount column and limit it to 1 .

// in front end

if(rank(aggr(Amount,Insured),2)<=1,Insured)

sijojoseph22
Creator II
Creator II
Author

Sorry for marking it wrongly.

We are trying to get the below record.

i.e the to display the Max insured by UMR and Insured. and also the Max amount and average by UMR and Insured

Max InsuredAvg Line SizeMAX
COMPANY2154370.665250019.2

Thanks in advance.

sunny_talwar

Check this out:

Capture.PNG

Expressions:

Avg: =If(Max > 0, Avg(TOTAL Aggr(Sum(Amount), UMR, Insured)))

Max: =Sum(If(Aggr(Sum(Amount), Insured, UMR) = Max(TOTAL Aggr(Sum(Amount), Insured, UMR)), Amount))

sijojoseph22
Creator II
Creator II
Author

Thanks