3 Replies Latest reply: Oct 4, 2012 8:04 AM by Stefan Wühl

# simplify expression

Hi.

It could simplify the formula in any way?

if(Nota_Pago >= 50,10,

if(Nota_Pago >= 20 and Nota_Pago < 50,9,

if(Nota_Pago >= 5 and Nota_Pago < 20,8,

if(Nota_Pago >= 0 and Nota_Pago < 5,7,

if(Nota_Pago >= -10 and Nota_Pago < 0,6,

if(Nota_Pago >= -20 and Nota_Pago < -10,5,

if(Nota_Pago >= -35 and Nota_Pago < -20,4,

if(Nota_Pago >= -50 and Nota_Pago < -35,3,

if(Nota_Pago >= -65 and Nota_Pago < -50,2,

if(Nota_Pago >= -80 and Nota_Pago < -65,1,0))))))))))

For example:

if(Nota_Pago >= 50,10,

>= 20 < 50,9,

>= 5 < 20,8,

>= 0 < 5,7,

>= -10 < 0,6,

>= -20 < -10,5,

>= -35 < -20,4,

>= -50 < -35,3,

>= -65 < -50,2,

>= -80 < -65,1,

0)

Regards.

• ###### Re: simplify expression

http://community.qlik.com/message/240288

I think it shows you some possible modifications to simplify your if() statement as well as replacing it with a mapping.

Regards,

Stefan

• ###### Re: simplify expression

Hi Stefan.

Thanks for responding.
But Nota_pago is an expression of a pivot table.

Regards.

• ###### Re: simplify expression

Ok,

so at least you should be able to use

if(Nota_Pago >= 50,10,

if(Nota_Pago >= 20 ,9,

if(Nota_Pago >= 5 ,8,

if(Nota_Pago >= 0 ,7,

if(Nota_Pago >= -10 ,6,

if(Nota_Pago >= -20 ,5,

if(Nota_Pago >= -35,4,

if(Nota_Pago >= -50 ,3,

if(Nota_Pago >= -65 ,2,

if(Nota_Pago >= -80 ,1,0))))))))))