Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
udit_kumar_sana
Creator II
Creator II

Aggr color code calculation optimization

Hi All,

How to optimize below expression the best way either in load script or in front end.

if(round(sum(total<XYZ, ABC> Aggr(sum({1<PQR={0},EFG=p(EFG)>}HEADCOUNT),XYZ, ABC)),.01)>1,

RGB(255,106,106), //red

if(round(sum(total<XYZ, ABC> Aggr(sum({1<PQR={0},EFG=p(EFG)>}HEADCOUNT),XYZ, ABC)),.01)=1,

RGB(0,232,116), //green

Yellow()))

Currently its written in chart expression background color expression.

It's taking too long time to load the table.

Thanks & Regards,

Udit

1 Reply
sunny_talwar

Not sure why you need Aggr() function here, from what I know (and AFAIK)

This

Sum(total<XYZ, ABC> Aggr(sum({1<PQR={0},EFG=p(EFG)>}HEADCOUNT),XYZ, ABC))


Should equal this

Sum({<PQR={0},EFG=p(EFG)>}HEADCOUNT)

Unless you have missed more dimensions in your Aggr() function. Notice, I removed 1 from the set analysis above. So may be try this:

If(Round(Sum({<PQR={0},EFG=p(EFG)>}HEADCOUNT), .01) > 1, RGB(255,106,106), //red

If(Round(Sum({<PQR={0},EFG=p(EFG)>}HEADCOUNT), .01) = 1, RGB(0,232,116), //green

Yellow()))