Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

bhaveshp90
Contributor III

How to write case statement in Qlikview ?

Hello,

I'm trying to convert the below case statement into QlikView.

Can someone help me with the same?

case

WHEN (value_type = 'P' AND Conv_Value_$ <= 10) THEN '<10%'

when (value_type = 'P' AND (Conv_Value_$ > 10 and Conv_Value_$ <= 14)) THEN  '10-14%'

when (value_type = 'P' AND (Conv_Value_$ > 14 and Conv_Value_$ <= 20)) THEN  '14-20%'

when (value_type = 'P' AND (Conv_Value_$ > 20 and Conv_Value_$ <= 25)) THEN  '20-25%'

when (value_type = 'P' AND (Conv_Value_$ > 25 and Conv_Value_$ <= 30)) THEN  '25-30%'

when (value_type = 'P' AND (Conv_Value_$ > 30 and Conv_Value_$ <= 35)) THEN  '30-35%'

when (value_type = 'P' AND (Conv_Value_$ > 35 and Conv_Value_$ <= 40)) THEN  '35-40%'

when (value_type = 'P' AND Conv_Value_$ > 40) THEN '>40%'

Else Null

end as Value_Bucket;

any help greatly appreciated,

thanks

Bhavesh

Tags (1)
1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: How to write case statement in Qlikview ?

if(value_type = 'P' AND Conv_Value_$ <= 10 ,'<10%',

if(value_type = 'P' AND Conv_Value_$ > 10 and Conv_Value_$ <= 14 ,'10-14%',

if(value_type = 'P' AND Conv_Value_$ > 14 and Conv_Value_$ <= 20 ,'14-20%',

if(value_type = 'P' AND Conv_Value_$ > 20 and Conv_Value_$ <= 25 ,'20-25%',

if(value_type = 'P' AND Conv_Value_$ > 25 and Conv_Value_$ <= 30 ,'25-30%',

if(value_type = 'P' AND Conv_Value_$ > 30 and Conv_Value_$ <= 35 ,'30-35%',

if(value_type = 'P' AND Conv_Value_$ > 35 and Conv_Value_$ <= 40 ,'35-40%',

if(value_type = 'P' AND Conv_Value_$ > 40) ,'>40%'))))))))

as Value_Bucket;


talk is cheap, supply exceeds demand
4 Replies
MVP & Luminary
MVP & Luminary

Re: How to write case statement in Qlikview ?

if(value_type = 'P' AND Conv_Value_$ <= 10 ,'<10%',

if(value_type = 'P' AND Conv_Value_$ > 10 and Conv_Value_$ <= 14 ,'10-14%',

if(value_type = 'P' AND Conv_Value_$ > 14 and Conv_Value_$ <= 20 ,'14-20%',

if(value_type = 'P' AND Conv_Value_$ > 20 and Conv_Value_$ <= 25 ,'20-25%',

if(value_type = 'P' AND Conv_Value_$ > 25 and Conv_Value_$ <= 30 ,'25-30%',

if(value_type = 'P' AND Conv_Value_$ > 30 and Conv_Value_$ <= 35 ,'30-35%',

if(value_type = 'P' AND Conv_Value_$ > 35 and Conv_Value_$ <= 40 ,'35-40%',

if(value_type = 'P' AND Conv_Value_$ > 40) ,'>40%'))))))))

as Value_Bucket;


talk is cheap, supply exceeds demand
vishsaggi
Esteemed Contributor III

Re: How to write case statement in Qlikview ?

May be try this?

IF(value_type = 'P' AND Conv_Value_$ <= 10, '<10%',

  IF(value_type = 'P' AND (Conv_Value_$ > 10 and Conv_Value_$ <= 14), '10-14%',

    IF(value_type = 'P' AND (Conv_Value_$ > 14 and Conv_Value_$ <= 20),  '14-20%',

      IF(value_type = 'P' AND (Conv_Value_$ > 20 and Conv_Value_$ <= 25),  '20-25%',

        IF(value_type = 'P' AND (Conv_Value_$ > 25 and Conv_Value_$ <= 30), '25-30%',

          IF(value_type = 'P' AND (Conv_Value_$ > 30 and Conv_Value_$ <= 35), '30-35%',

            IF(value_type = 'P' AND (Conv_Value_$ > 35 and Conv_Value_$ <= 40), '35-40%',

              IF(value_type = 'P' AND Conv_Value_$ > 40),'>40%', Null()))))))) AS Value_Bucket

bhaveshp90
Contributor III

Re: How to write case statement in Qlikview ?

thank you, it worked out for me

bhaveshp90
Contributor III

Re: How to write case statement in Qlikview ?

thank you, I understood now how to write the case statements in Qlikview