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: 
nehasaxena
Creator II
Creator II

Max/Min with aggr function

Hi All,

I am using below expression -

Num(Max(aggr(Sum([Loss Paid Filter])/sum([Written Premium Filter]),LOB,product)),'#,##0.00%')

I am using max function but it is giving me min value.

and with min expression it is giving zero.

Please help me with the correct expression.

Let me know if further details required

Best regards,

Neha

11 Replies
Anil_Babu_Samineni

What if you write some thing like below. Does this expression gives output to you?

Num(aggr(Sum([Loss Paid Filter])/sum([Written Premium Filter]),LOB,product),'#,##0.00%')

Would you able to provide snapshot for that data atleast 10 rows

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Sergey_Shuklin
Specialist
Specialist

Hello, Neha!

It's interesting case and it seems like you have your "max(aggr(" case on negative values so "max" is returning the min value, and a "true" max is zero. Maybe there are some format restrictions in the chart (on Number tab) where your format-condition '#,##0.00%' doesn't make a sense?

nehasaxena
Creator II
Creator II
Author

I observed that this expression is not considering full records. See  the image. This table is having expression without aggr. My aggr expression is not considering 2017 Q1 records. I need to modify it.

Any suggestions are welcome.

Thanks.

Best Regards,

Neha

table.png

nehasaxena
Creator II
Creator II
Author

I want to display this expression in text box so i have to use Num formatting.

Regards,

Neha

antoniotiman
Master III
Master III

What is Expression in Your table ?

nehasaxena
Creator II
Creator II
Author

Sum([Loss Paid Filter])/sum([Written Premium Filter])

antoniotiman
Master III
Master III

Have You tried to add Quarter in Aggr(.......,Quarter) expression ?

nehasaxena
Creator II
Creator II
Author

Hi,

With Num(aggr(Sum([Loss Paid Filter])/sum([Written Premium Filter]),LOB,product),'#,##0.00%') this expression output is -

 

LOBproductQuarterLoss Ratio
LOB1P1Q1

1.40%

and with Sum([Loss Paid Filter])/sum([Written Premium Filter]) this expression output is -

 

LOBProductQuarter2017Q1 2017Q2
LOB1P1 208.76%1.40%

So basically with aggr function  results display is wrong. For Q2 value is missing and Q1 has value that is actually for q2.

I am confused with the results.

nehasaxena
Creator II
Creator II
Author

Yeah thanks for reminding, I missed quarter in  aggr expression. But the issue still exist with min aggr. Max aggr is working fine.

Max Aggr Expression -

Num(Max(aggr(Sum([Loss Paid Filter])/sum([Written Premium Filter]),LOB,product,YearQuarter)),'#,##0.00%')

This is giving me correct result - 208.76%

Min Aggr Expression -

Num(Min(aggr(Sum([Loss Paid Filter])/sum([Written Premium Filter]),LOB,product,YearQuarter)),'#,##0.00%')

For this output is 0.00% ,  actually it should give 1.40%