Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to write a single IF statement

Hello

How can I write the below sql case statement in Qlik sense

CASE WHEN [MY ORG CODE] = '11NA' THEN 'MY ORG NAME' ELSE [MY ORG CODE] END

I have tried using match but I am not getting the correct results

=match([MY ORG CODE], '11NA', 'MY ORG NAME', [MY ORG CODE])

Thanks any help appreciated

Ian

1 Solution

Accepted Solutions
oknotsen
Master III
Master III

Why did you not try an actual IF statement?

if([MY ORG CODE] = '11NA', [MY ORG NAME], [MY ORG CODE]) as [MY ORG CODE]


if - script and chart function ‒ Qlik Sense

May you live in interesting times!

View solution in original post

5 Replies
oknotsen
Master III
Master III

Why did you not try an actual IF statement?

if([MY ORG CODE] = '11NA', [MY ORG NAME], [MY ORG CODE]) as [MY ORG CODE]


if - script and chart function ‒ Qlik Sense

May you live in interesting times!
bohravanraj
Partner - Creator II
Partner - Creator II

if( Match([MY ORG CODE] , '11NA' ), 'MY ORG NAME' ,[MY ORG CODE])

Regards,
Vanraj Dinesh Bohra

sunny_talwar

Another option using Pick() function

Pick(Match([MY ORG CODE], '11NA') + 1, [MY ORG CODE], 'MY ORG NAME') as FieldName

Anonymous
Not applicable
Author

Thanks. That worked

oknotsen
Master III
Master III

Match is not needed and would only slow things down.

May you live in interesting times!