Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

br00127334
New Contributor II

If condition in Map expression

 

Good evening.

 

I'm trying to make a condition on the map where I have a margin in a certain UF if it gets below red and stays above Green.

 

I am considering many IFs because they are not considering ELSE.

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AL'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AL'}>} RECLIQUID) - 0.0251 <8.00,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AM'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AM'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'BA'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'BA'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AC'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AC'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'CE'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'CE'}}}} - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'DF'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'DF'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'ES'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'ES'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'GO'}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'GO'}>} RECLIQUID) - 0.0251 <= 8.00,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MA'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MA'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MG'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MG'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MS'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MS'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MT'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MT'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AP'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AP'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PA'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PA'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PE'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PE'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PI'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PI'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PR'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PR'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PB'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PB'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RJ'}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RJ'}}}} - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RN'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RN'}}}} - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RO'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RO'}>} RECLIQUID) - 0.0251 <= 6.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RR'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RR'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RS'}}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATE = {'RS'}}}} - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SC'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SC'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SE'}} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SE'}}}} - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SP'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SP'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'TO'}>} VAL_MARGEM)

 

/

 

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'TO'}>} RECLIQUID) - 0.0251 <= 20.50,

 

 

Green())))))))))))))))))))))))))))

 

Tags (1)
1 Solution

Accepted Solutions
rangam_s
Contributor II

Re: If condition in Map expression

You need to make small correction to your if condition.

As per my understanding single record will not have two statuses, so you need to use next if condition for false scenario.

5 Replies
rangam_s
Contributor II

Re: If condition in Map expression

You need to make small correction to your if condition.

As per my understanding single record will not have two statuses, so you need to use next if condition for false scenario.

rangam_s
Contributor II

Re: If condition in Map expression

Try this

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AL'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AL'}>} RECLIQUID) - 0.0251 <8.00,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AM'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AM'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'BA'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'BA'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AC'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AC'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'CE'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'CE'}}}} - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'DF'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'DF'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'ES'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'ES'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'GO'}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'GO'}>} RECLIQUID) - 0.0251 <= 8.00,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MA'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MA'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MG'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MG'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MS'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MS'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MT'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'MT'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AP'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'AP'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PA'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PA'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PE'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PE'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PI'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PI'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PR'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PR'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PB'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'PB'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RJ'}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RJ'}}}} - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RN'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RN'}}}} - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RO'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RO'}>} RECLIQUID) - 0.0251 <= 6.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RR'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RR'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'RS'}}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATE = {'RS'}}}} - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SC'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SC'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SE'}} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SE'}}}} - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SP'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'SP'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

if (Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'TO'}>} VAL_MARGEM)

/

Sum ({$ <NOM_CLI - = {'EXPENSES'}, STATUS = {'TO'}>} RECLIQUID) - 0.0251 <= 20.50,Green(),

Red())))))))))))))))))))))))))))

rangam_s
Contributor II

Re: If condition in Map expression

Show change color coding as you want, I thinking it will opposite to what you have expected.

br00127334
New Contributor II

Re: If condition in Map expression

if(Sum({$<NOM_CLI-={'GASTOS PROSEGUR'}, ESTADO ={'AL'}>}VAL_MARGEM)

/

Sum({$<NOM_CLI-={'GASTOS PROSEGUR'}, ESTADO ={'AL'}>}REC_LIQUIDA) - 0.0251 <= 8.00, red(), Green()

Doesn't work

br00127334
New Contributor II

Re: If condition in Map expression


if(Sum({$<NOM_CLI-={'GASTOS '}, ESTADO ={'AL'}>}VAL_MARGEM)
/
Sum({$<NOM_CLI-={'GASTOS }, ESTADO ={'AL'}>}REC_LIQUIDA) - 0.0251 <= 8.00, red(), Green()),


if(Sum({$<NOM_CLI-={'GASTOS }, ESTADO ={'AM'}>}VAL_MARGEM)
/
Sum({$<NOM_CLI-={'GASTOS }, ESTADO ={'AM'}>}REC_LIQUIDA) - 0.0251 <= 20.50, red(), Green()),


if(Sum({$<NOM_CLI-={'GASTOS }, ESTADO ={'BA'}>}VAL_MARGEM)
/
Sum({$<NOM_CLI-={'GASTOS }, ESTADO ={'BA'}>}REC_LIQUIDA) - 0.0251 <= 20.50, red(), Green()),

Doesn't work

Community Browser