Replace null with zero in superset

3.3k Views Asked by At

I am creating a line chart on superset which is being plotted against some aggregates function and time column. I am getting null when at that specific time no event is there due to this I am getting broken charts. Is there a way to replace these nulls with 0?

1

There are 1 best solutions below

0
On

If you are on the chart explore, click on the 3 dots next to dataset name, and click on "Edit Dataset". Go into "Calculated columns" tab and in there click on "Add item". In the SQL field you can then define your condition that will be applied to the column. So you can write SQL like IF(my_column IS NULL, 0, my_column) and label for this calculated column. On your chart, use this calculated column then. You can use any SQL statement you need in the box (format transformation, CASE WHEN, IF, etc.)