Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to use if statement in a label expression

HI,

I am trying to use an expression in a Lable.

Is there any way to use if statement in the lable.

I am trying to read the selected monthname, if the monthname is dec then execute a set of statements else do another.

MonthName is a field from Jan to Dec.

Syntax:

=IF({$<[MonthName]={'Dec'}>},1,2)

How does this work ?

Thanks,

Srihari



1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hi Srihari,

Use

=If(Match(MonthName, 'Nov', 'Dec') > 0, 1, 2)


That should work.

View solution in original post

4 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

Use the below code

if(MonthName ='Dec' ,1,2)

Not applicable
Author

HI Deepak,

that is working fine.

Can this work ?

I want to get 1 when the month is in nov or dec.

Syntax :

If (MonthName='Dec','Nov',1,2)

or

If (MonthName in ('Dec','Nov'),1,2)

Some thing like this ?

Thanks,

Srihari

Miguel_Angel_Baeyens

Hi Srihari,

Use

=If(Match(MonthName, 'Nov', 'Dec') > 0, 1, 2)


That should work.

Not applicable
Author

Thank you Baeyens.

Thats working.

Thanks for getting me thorugh Deepak and Baeyens.

Have a nice day !