Skip to main content

alt - script and chart function

The alt function returns the first of the parameters that has a valid number representation. If no such match is found, the last parameter will be returned. Any number of parameters can be used.


alt(case1[ , case2 , case3 , ...] , else)


The alt function is often used with number or date interpretation functions. This way, QlikView can test different date formats in a prioritized order. It can also be used to handle NULL values in numerical expressions.

Examples and results:  

Examples and results
Example Result

alt( date#( dat , 'YYYY/MM/DD' ),

date#( dat , 'MM/DD/YYYY' ),

date#( dat , 'MM/DD/YY' ),

'No valid date' )

This expression will test if the field date contains a date according to any of the three specified date formats. If so, it will return a dual value containing the original string and a valid number representation of a date. If no match is found, the text 'No valid date' will be returned (without any valid number representation).

alt(Sales,0) + alt(Margin,0)

This expression adds the fields Sales and Margin, replacing any missing value (NULL) with a 0.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: