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

How to use decode function in expression

Hello,

Please tell me how can I use the decode function in QlikView as we use in SQL.


Like in sql I write:

sum(SELLING_PRICE)/decode(sum(NUM_DEVICES),0,1,sum(NUM_DEVICES))/1000

How can I write this in QlikView expression?

Thanks in advance for your time.

Regards

3 Replies
selvakumarsr
Creator
Creator

No you cannot use  decode function in expression

Selva

PrashantSangle

Hi,

Yes you can not use decode function in Qlikview but

You can use if -else as  alternative to decode

Use like this,

sum(SELLING_PRICE)/if(sum(NUM_DEVICES)=0,1,sum(NUM_DEVICES))/1000

or

If(sum(NUM_DEVICES)=0,SUM(SELLING_PRICE),

SUM(SELLING_PRICE)/SUM(NUM_DEVICES)

)/1000

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Thanks Max !