Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
kristeljoymalapitan

How to use CASE WHEN function in Qlik Sense?

Good Day.

May I ask questions regarding syntax/function on Qlik Sense.

What is the equivalent  syntax of CASE WHEN  in Qlik Sense?


Please see below sample query

SELECT  CASE WHEN computed_dpd <=0 THEN 0 ELSE computed_dpd END computed_dpd_sample FROM temp_table;

scenario: to set computed_dpd to zero (0) if <=0 else retain the value of computed_dpd

7 Replies
surendraj
Specialist
Specialist

you can try below

load  if( computed_dpd <=0, '0', computed_dpd ) as Your field name,

     ...

FROM ...;

 

 

 

kristeljoymalapitan
Author

Hi,

Thanks for your prompt response.

I already tried below functions but still no effect on the data,

Please refer to attached screenshot of output under COMPUTED_DPD_REV column

Thank you

surendraj
Specialist
Specialist

Simply you can try with

Rangemax(COMPUTED_DPD,0) as COMPUTED_DPD_REV 

 

kristeljoymalapitan
Author

Hi,

All negative and zero computed_dpd  was already set to zero (0) using below function, However all positive value was gone, not included on the data

--load  if( computed_dpd <=0, '0', computed_dpd ) as Your field name,

Thank you

surendraj
Specialist
Specialist

so try with range max.

kristeljoymalapitan
Author

Hi,  it was already works, Thanks for your support.

 

sunny_talwar

The image you posted looked good... COMPUTED_DPD_REV is starting from 0 onwards...what is the issue?