How to show 0 insteal of NULL on Summary cards?

I have a dashboard which contains summaries cards on top a detailed list.

The clients complained of the “NULL” value, so first thing I did was try to hide the card when the value is null, by checking this option:

Even with the option turned ON, the card still shows on the dashboard with null value.

To give more info, the summary card was created using a Summary field, which wraps the card model SQL.

That said, I wanted to know if

  1. Is possible to hide the card? If yes, why isn’t working for me?
  2. It is possible to show 0 instead of null, using a custom expression?

Thanks in advance,

Kim.

Hi! I think you need Allow Conditional Hiding of Cards that Return NULL or 0 · Issue #49772 · metabase/metabase · GitHub, but the problem is simply that you need to make that question to return an empty result set (right now it’s returning something, a null)

Yes, the coalesce() function returns the first non-NULL argument, so you can use something like

coalesce([mycolumn], 0)

to convert NULLs to zeroes.

The same function exists in most SQL databases.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.