1 Reply Latest reply: Oct 27, 2016 5:46 AM by Sunny Talwar RSS

    Aggr color code calculation optimization

    Udit Kumar Sanadhya

      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

        • Re: Aggr color code calculation optimization
          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()))