I am trying to count unique ID numbers in Tableau; however, when I filter by year, there are some years with no ID numbers. As a result, I want the number 0 to be shown, but instead Tableau just displays a blank. I was trying to use a calculated field like this, but it doesn't seem to be working.
IF(COUNTD([ID]) > 0) THEN COUNTD([ID])
ELSE 0
END
Alternatively, I tried this, but it also doesn't work.
IF ISNULL(COUNTD([ID])) THEN 0
ELSE COUNTD([ID])
END
Here is what the worksheet looks like. It is very simple.
Filtering out some of the years, you can see how the zero values are simply displayed as blanks.

