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

Aggr with AVG, SUM and Max

Hi all

Please bear with me, quite new to QV and still learning!

My data has multiple rows per [Claim Ref] and I want to find the [Total Claim Amount], the Avg [Total Claim Amount] and the max.

There are / can be separate amounts on each row per claim ref, for example

Claim Ref   Total Claim Amount

1234           100

1234           200

9876           0

9876           100

9876           500

and so on

So in this example, the Sum would be 900, the avg = 450 and the max = 600

I have been playing around with Aggr and I just cant get it to work!

To complicate matter further, I am filtering the expressions depending on [Type] as well!

Max(aggr(sum((IF([Claim Type] = 'Property',[Total Claim Amount]))))

What am I doing wrong?!

1 Solution

Accepted Solutions
sunny_talwar

May be this:

For Max

Max({<[Claim Type]= {'Property'}>}Aggr(Sum({<[Claim Type]= {'Property'}>} [Total Claim Amount]), [Claim Ref]))

For Avg

Avg({<[Claim Type]= {'Property'}>}Aggr(Sum({<[Claim Type]= {'Property'}>} [Total Claim Amount]), [Claim Ref]))

View solution in original post

2 Replies
sunny_talwar

May be this:

For Max

Max({<[Claim Type]= {'Property'}>}Aggr(Sum({<[Claim Type]= {'Property'}>} [Total Claim Amount]), [Claim Ref]))

For Avg

Avg({<[Claim Type]= {'Property'}>}Aggr(Sum({<[Claim Type]= {'Property'}>} [Total Claim Amount]), [Claim Ref]))

Anonymous
Not applicable
Author

Many thanks Sunny T!