Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
nix1
Contributor
Contributor

Multiple conditional if statement with variable

I have a create a variable  Selected_City =only({<City={"$(Selected_City)"}>} City)

I have a text box where I want to display the resultant Text of various conditions including this Selected_City

I have used these conditions:

if(City='$(=Selected_City)' and [Overall Compliance]='Compliant', 'Compliant',
if(City='$(=Selected_City)' and ([Membership Type]='Observer' or (vYear_Current-[Joining Year]<=2)), 'In progress', 'Not compliant')))

where vYear_Current=2021

The result is only giving me 'Not compliant' . I have tried various different things but no luck.

My data for example:

City   Membership Type   Joining Year   Overall Compliance

X         Observer                     2020                  Not compliant                        --> should become 'In progress'

Y         Megacity                      2019                  Not compliant                        -> should become 'In progress'

Z         Megacity                     2005                   Compliant

A         Megacity                     2010                   Not compliant

 

1 Reply
BenjaminT
Partner - Creator
Partner - Creator

Hi,

I would take another look at your variable definition there, as it looks to be referencing itself. 

What do you want Selected_City to store, a value that the user has selected in the City field?

Ben