Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
spividori
Valued Contributor

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

Re: simplify expression

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
Valued Contributor

Re: simplify expression

Hi Stefan.

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


Captura.JPG

Regards.

MVP
MVP

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

Community Browser