Hi, I am building out some metrics where I have a ...
# gooddata-cloud
c
Hi, I am building out some metrics where I have a metric each that is filtered down on different columns but when I sum both those metrics I am only getting a result when both columns have data, is there any reason for this
m
Hi, This usually happens due to NULL handling. When one of the filtered metrics has no matching rows, it returns NULL. In SQL logic, adding a number to NULL results in NULL, which is why you only see a value when both filtered metrics have data. You can resolve this by wrapping each metric in
IFNULL()
, for example:
Copy code
IFNULL(Metric A, 0) + IFNULL(Metric B, 0)
This ensures that missing values are treated as 0 rather than NULL. If you’d like, feel free to share the metric definitions. IFNULL documentation is here.
1
c
ah great that fixed it