Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
ltc
Partner - Creator
Partner - Creator

Simple If Contains Statement

Hello,

I have a simple statement that I need help with.

If [date] field contains '2016', then display as '2016'

If [date] field contains '2017', then display as '2017'

If [date] field contains '2018', then display as '2018'

How do I properly write this up as one expression?

Thanks!

1 Solution

Accepted Solutions
Anthony_Ventura
Employee
Employee

You can enter the following as a chart expression:

=if(OrderDate like '*2016*','2016',

     if(OrderDate like '*2017*','2017',

          if(OrderDate like '*2018*','2018','Other')))

View solution in original post

3 Replies
Anthony_Ventura
Employee
Employee

You can enter the following as a chart expression:

=if(OrderDate like '*2016*','2016',

     if(OrderDate like '*2017*','2017',

          if(OrderDate like '*2018*','2018','Other')))

ogster1974
Master II
Master II

Why can't you just do

=Year([date field])

Not sure why you'd need an IF statement for this requirement.
jayanttibhe
Creator III
Creator III

Hi 

We can remove the nested If statements altogether ... 

Try below :: 

Pick(wildmatch(OrderDate,'*2016*','*2017*','*2018*',OrderDate),2016,2017,2018,'Other')