MicroStrategy ONE

Coalesce

Returns the value of the first non-null argument.

Syntax

Coalesce (Argument1, Argument2, ..., ArgumentN)

Where

The arguments for the Coalesce function can be any expression that can be evaluated as null or not null.

Usage Notes

You can use the Coalesce function in defining a metric, but more often it is used with the Query Builder feature to support the inclusion of the Coalesce function in SQL queries. Refer to the example below for more detailed information.

Example

Your database has two tables T1 and T2 that include the column MONTH_ID with the format yyyymm. You want to filter on a specific month, but you are not sure which table has been populated with month data. In the Query Builder Editor, you can filter your SQL query by creating the condition Coalesce(T1.MONTH_ID, T2.MONTH_ID) = 202410. The WHERE clause of the SQL query checks for the first non-null MONTH_ID column and compares it to the value 202410.

For more information on Query Builder, see the Advanced Reporting Help.