Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Honored Contributor 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
Highlighted
MVP
MVP

Re: CASE in Qlikview

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
Highlighted
MVP
MVP

Re: CASE in Qlikview

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

Highlighted
Esteemed Contributor

Re: CASE in Qlikview

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')

Highlighted

Re: CASE in Qlikview

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)

Highlighted
Esteemed Contributor

Re: CASE in Qlikview

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

Vikas

Highlighted
Not applicable

Re: CASE in Qlikview

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

Highlighted
Honored Contributor III

Re: CASE in Qlikview

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

Highlighted

Re: CASE in Qlikview

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

First 4

LOAD Pick....