IFNULL allows you to predefine how the GoodData Platform addresses any missing values that are returned by an expression. If a metric expression that is wrapped within an IFNULL statement ever returns a null value, the replacement number specified in the second parameter of the IFNULL function is inserted in place of the null value.
IFNULL is especially useful in cases where a sub-metric is referred to within another metric's definition. Wrapping the sub metric in an IFNULL statement keeps the encompassing metric from becoming null due to one of its components returning a null value. For more information, see IFNULL Best Practices.
SELECT IFNULL(metric, replacement_value)
SELECT IFNULL(SUM(Amount), 0)
SELECT IFNULL(SUM(FB_Cost + TW_Cost), 0)
SELECT IFNULL(SUM(Amount) + 100, 1)
Supported replacement values include constants, but not other metric expressions.