Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
spividori
Specialist
Specialist

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.

3 Replies
swuehl
MVP
MVP

Please check this thread:

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

spividori
Specialist
Specialist
Author

Hi Stefan.

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


Captura.JPG

Regards.

swuehl
MVP
MVP

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))))))))))