Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

praveenak
New Contributor II

Optimized approach for nested IF statement

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

3 Replies
praveenak
New Contributor II

Re: Optimized approach for nested IF statement

Hi All,

Can someone provide a solution to the above?

Thanks in Advance.

Re: Optimized approach for nested IF statement

Maybe this:

If(RangeMin(

     fabs(Sum({<[ID] = {'6'}>} value)),

     fabs(Sum({<[ID] = {'9'}>} value)),

     fabs(Sum({<[ID] = {'8'}>} value)),

     fabs(Sum({<[ID] ={'7'}>} value)),

     fabs(Sum({<[ID] = {'3'}>} value))) > 0,

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

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

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

If(

RangeMin(

     fabs(Sum({<[ID] = {'6'}>} value)),

     fabs(Sum({<[ID] = {'9'}>} value)),

     fabs(Sum({<[ID] = {'8'}>} value)),

     fabs(Sum({<[ID] ={'7'}>} value)),

     fabs(Sum({<[ID] = {'3'}>} value))) = 0 or isnull($(Vscrvalue1))=-1, '#d3d3d3'))



praveenak
New Contributor II

Re: Optimized approach for nested IF statement

Thanks For the reply.

Will work on it and come back for anything needed.

Community Browser