Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

what is the syntax for if else in qliksense for visualization

what is the syntax for if else in qliksense for visualization

10 Replies
MVP
MVP

Re: what is the syntax for if else in qliksense for visualization

It should be the same one as QlikView

If(Condition, True, False)

undergrinder
Valued Contributor II

Re: what is the syntax for if else in qliksense for visualization

Hi Sunny,

It is exactly the same

G.

MVP
MVP

Re: what is the syntax for if else in qliksense for visualization

Yes, I believe so

Not applicable

Re: what is the syntax for if else in qliksense for visualization

Thanks. Please let me if it is possible to check for a range of values and give different colors. Something like 20-30 and give red color, 30-40 yellow color etc..

MVP
MVP

Re: what is the syntax for if else in qliksense for visualization

Sure, try like this:

If(FieldName > 20 and FieldName <= 30, Red(),

If(FieldName > 30 and FieldName <= 40, Yellow(),

If(FieldName > 40, Green())))

simondachstr
Valued Contributor III

Re: what is the syntax for if else in qliksense for visualization

if else should generally be your option of last resort when it comes to writing expressions.

Not applicable

Re: what is the syntax for if else in qliksense for visualization

if((Sum()/Sum()) < 0.3,red(),

if((Sum()/Sum()) > 0.4,Blue()),

if((Sum()/Sum()) > 0.5,Green()))

This is giving syntax error? If I comment the last line and adjust the brackets it works properly. But when I put the last line it gives error?

gompa786
Contributor III

Re: what is the syntax for if else in qliksense for visualization

If(FieldName > 20 and FieldName <= 30, Red(),

If(FieldName > 30 and FieldName <= 40, Yellow(), Green()

))

please try this

MVP
MVP

Re: what is the syntax for if else in qliksense for visualization

May be you need another parenthesis at the end to close the first if:

if((Sum()/Sum()) < 0.3,red(),

    if((Sum()/Sum()) > 0.4,Blue()),

          if((Sum()/Sum()) > 0.5,Green()

          )

    )

)