Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
prma7799
Master III
Master III

CASE in Qlikview

How to write below CASE statement into Qlikview

1)

SELECT DISTINCT TOP 4 [Type]

, 'FGType_Name' =

CASE

WHEN [Type] = 0 THEN 'SA'

  WHEN [Type] = 1 THEN 'SE'

WHEN [Type] = 2 THEN 'IL'

WHEN [Type] = 3 THEN 'ST'

END

2)

CASE

   WHEN left([No_],1) IN (3,4) THEN 'PL'

    END AS [BSP]

3)

CASE WHEN No_ LIKE 'CE%' THEN '1' ELSE '0' END AS

FROM TEMP a

WHERE a.No_ IS NOT NULL AND a.No_ <> '';

THANKS

1 Solution

Accepted Solutions
swuehl
MVP
MVP

There is no CASE statement to use within a LOAD statement in QlikView, but you can use other conditional functions like pick()

Pick(Type+1, 'SA','SE','IL','ST')

or nested if() .

View solution in original post

7 Replies
swuehl
MVP
MVP

There is no CASE statement to use within a LOAD statement in QlikView, but you can use other conditional functions like pick()

Pick(Type+1, 'SA','SE','IL','ST')

or nested if() .

vikasmahajan

you can use pick & match  like this

=pick(alt(match(Only(_DemandDays), 30, 60, 90, 180, 360, 365) , 0)+1,

'Mixed Demand',

'Demand 30 Days',

'Demand 60 Days',

'Demand 90 Days',

'Demand 180 Days',

'Demand 365 Days',

'Demand 365 Days')

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
rubenmarin

The other 2 cases can be done like this:

2) If(Match(Left([No_], 1), '3', '4'), 'PL') as [BSP]

3) If([No_] like 'CE*', 1,

     If(Len(Trim([No_]))>0, 0) as

 //To check it has value and it's not an empty value (if it's not in the Where clause)

vikasmahajan

Case Statement is not available in qlikview instead of this we need to use PICK & MATCH

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable

Perhaps the use of a mapping table and the applymap function could be looked at? Alternatively, use if statements in your script...

prma7799
Master III
Master III
Author

Hi swuehl‌,

Thanks for your reply ..

How can i use TOP function for Pick(Type+1, 'SA','SE','IL','ST') in this.

In this table we have many records that for I used first function also but using that I am unable to achieve result

for this (Pick(Type+1, 'SA','SE','IL','ST'))

Thanks

rubenmarin

Hi, I'm not sure to understand your issue, I think it should work, you tried something like?:

First 4

LOAD Pick....