Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

manigunta
Contributor

CASE statement in QlikSense

HI ,

i need to write case statement in qliksense for below statement

CASE  WHEN column_name  IN ('A-Dallas', 'A-Texas') THEN 'US' end

I tried in qliksense as below, which throwed error and displayed nothing

if(wildmatch([ column_name],'A*', 'US'))

Can anyone please help

1 Solution

Accepted Solutions
MVP
MVP

Re: CASE statement in QlikSense

You have incorrect positioning of the parenthesis

This is incorrect

If(WildMatch([ column_name],'A*', 'US'))

Try this instead

If(WildMatch([ column_name],'A*'), 'US')

13 Replies
kvanandan1
Contributor

Re: CASE statement in QlikSense

Hi,


Please try


if(WildMatch([column_name],'A*')=1,'US')

MVP
MVP

Re: CASE statement in QlikSense

You have incorrect positioning of the parenthesis

This is incorrect

If(WildMatch([ column_name],'A*', 'US'))

Try this instead

If(WildMatch([ column_name],'A*'), 'US')

manigunta
Contributor

Re: CASE statement in QlikSense

How can i deal with blank values

when i have blank i need to get as '1' if have some value then '0'

manigunta
Contributor

Re: CASE statement in QlikSense

hi

How can i deal with blank values

when i have blank i need to get as '1' if have some value then '0'

can you please help on this

MVP
MVP

Re: CASE statement in QlikSense

Use Len(Trim()).... for example

If(Len(Trim(FieldName)) = 0, 1, 0) as Flag

manigunta
Contributor

Re: CASE statement in QlikSense

Hi

it is throwing error

MVP
MVP

Re: CASE statement in QlikSense

Did you replace Fieldname with your own field?

manigunta
Contributor

Re: CASE statement in QlikSense

yes

i used as this

If(Len(Trim(column_name)) = 0, 1, 0)

MVP
MVP

Re: CASE statement in QlikSense

Can you post a screenshot of the error message?