Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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

Labels (1)
1 Reply
sunny_talwar
MVP
MVP

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()))