I have some metrics and KPIs that report on counts...
# gooddata-platform
w
I have some metrics and KPIs that report on counts and percentages. When there are counts and percentages that are 0, the insight or KPI shows a "-" instead of 0. Is there a way to change this behavior?
f
Hi Willie. Note that there is a difference between a metric resulting in the number 0, and the value being null. As you can see from my screenshot, if the KPI’s metric’s calculation results in a 0, the KPI should be able to display it. The dash
-
shows up either when there is no data or the result is null. In case of a null result, you can try building a metric using the IFNULL statement to make sure that it results in a 0 whenever the result of the calculation would be null.
m
Let me add that apart from IFNULL function in the metric, there might be one more way to handle this - metric formatting. You can use the conditional number format to modify how NULL/empty metric value is displayed using the
[=null]
selector. For example this formatting expression will format positive and negative numbers normally and show “0” instead of null/empty.
Copy code
[=null]0;
[<0]-#,##0.00;
#,##0.00
While the IFNULL changes the resulting value, the metric format only changes how the resulting value is displayed. Note that in case of KPI, the metric formatting is only applied to the “value” and “previous period value”, but not to the autogenerated “% change”.