Qlik Community

QlikView Documents

Documents for QlikView related information.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

You can "Alt" it

nareshguntur
Valued Contributor

You can "Alt" it

I came across an interesting function "Alt".

Yes. Its Alt.

* For those who haven't come across this function.

It gives the fist number among the values it read.

alt('x',1,2) - This basically returns 1.

Qlik Help has enough description on this.

Advantage: If you want to check for isnum and then want to replace a value like 1 or 0 if the value is not a number, rather than using an "IF CONDITION", this can help.

Attached is the qvw with an example.

For the date 2013-02-01, I don't have an exchange rate. So, if no exchange rate is updated, the product shows 0 which is technically correct but the desired result for a user might not be this.

If no exchange rate is updated,I want to show the Sales as is.

Here, I need not go for an if condition to check if Exchange Rate don't have any value, the Sales should be multiplied with 1.

Instead of using an if condition to check if there's a value, I can go for Alt.

sum(LocalSales*Alt(ExRate,1)).

Whenever ExRate doesn't have any number in it, 1 is replaced.

Cheers,

Naresh

Attachments
Version history
Revision #:
1 of 1
Last update:
‎11-27-2015 08:20 AM
Updated by: