3 Replies Latest reply: Mar 16, 2017 6:43 AM by Praveena Kumar RSS

    Optimized approach for nested IF statement

    Praveena Kumar

      Hi All,

       

      Am using the below expression in my dashboard for some background change of an extension in qliksense.

       

      if(sum({<[ID]={'6'}>}value)=0

      or sum({<[ID]={'9'}>}value)=0

      or sum({<[ID]={'8'}>}value)=0

      or sum({<[ID]={'7'}>}value)=0

      or sum({<[ ID]={'3'}>}value)=0

      or isnull($(Vscrvalue1))=-1, '#d3d3d3',

       

      if(sum({<[ID]={'6'}>}value)<>0

      and sum({<[ID]={'9'}>}value)<>0

      and sum({<[ID]={'8'}>}value)<>0

      and sum({<[ID]={'7'}>}value)<>0

      and sum({<[ID]={'3'}>}value)<>0

      and $(Vscrvalue1) >=only({<MId = {1}>}Upper_Bound),'#46c646',

       

      if(sum({<[ID]={'6'}>}value)<>0

      and sum({<[ID]={'9'}>}value)<>0

      and sum({<[ID]={'8'}>}value)<>0

      and sum({<[ ID]={'7'}>}value)<>0

      and sum({<[ID]={'3'}>}value)<>0

      and $(Vscrvalue1) < only({<MId = {1}>}Upper_Bound)

      and $(Vscrvalue1)>only({<MId = {1}>}Lower_Bound), '#FFF400',

       

      if(sum({<[ID]={'6'}>}value)<>0

      and sum({<[ID]={'9'}>}value)<>0

      and sum({<[ID]={'8'}>}value)<>0

      and sum({<[ ID]={'7'}>}value)<>0

      and sum({<[ ID]={'3'}>}value)<>0

      and $(Vscrvalue1) < only({<MId = {1}>}Lower_Bound),'#ee5a35',))))

       

      Can you provide a better, fast and optimized way to achieve this?

       

      Thanks,

      Praveena Kumar