Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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;
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;
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
thank you, it worked out for me
thank you, I understood now how to write the case statements in Qlikview