Early Access: The content on this website is provided for informational purposes only in connection with pre-General Availability Qlik Products.
All content is subject to change and is provided without warranty.
Skip to main content Skip to complementary content

coalesce - script and chart function

The coalesce function returns the first of the parameters that has a valid non-NULL representation. Any number of parameters can be used.

Syntax:  

coalesce(expr1[ , expr2 , expr3 , ...])

Return data type: dual

Arguments
Argument Description
expr1 The first expression to check for a valid non-NULL representation.
expr2 The second expression to check for a valid non-NULL representation.
expr3 The third expression to check for a valid non-NULL representation.
Examples: Chart expressions
Example Result

Coalesce(ProductDescription, ProductName, ProductCode, 'no description available')

This expression will select between three different product description fields when some fields do not have values for the product. Following the order listed in the function, the first field with a non-null value is returned. If none of the fields contain a value, the result will be no description available.

Coalesce(TextBetween(FileName, '"', '"'), FileName)

This expression will trim potential enclosing quotes from the field FileName. If the FileName given is quoted, these are removed, and the enclosed, unquoted FileName is returned. If the TextBetween function doesn't find the delimiters it returns null, which the Coalesce rejects, returning instead the raw FileName.

Example - Coalesce fundamentals

Example - Replace null values with a prioritized alternative value

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!