5 Replies Latest reply on Mar 27, 2020 7:37 AM by Brent Van Scoy

# Display Zero if Count Records is Zero - In Dashboard

Hello,

I am counting records in a worksheet and then using it as part of my dashboard. If the worksheet has no records, it currently shows blank. I would like to display a 0 instead of having the box look blank.

I have read many posts that discuss what to do in a table, but that does not work for this problem.

Current

Simple calculation:  COUNT([Sales_Id])

Attempts with no success

CASE COUNT([Sales_Id]) when 0 THEN 0

ELSE COUNT([Sales ID]) END

IIF(ISNULL(COUNT([Sales ID])), 0, COUNT([Sales ID]))

Similar calculation

Also working with this calculation, but if I figure out above, I am guessing it will solve this too.

Total Volume] / 1000000

Thanks for any help!!

• ###### 1. Re: Display Zero if Count Records is Zero - In Dashboard

Hi

I guess that Tableau may recognize it as NULL in case of no records counted.

Thus, why not try the following?

CASE COUNT([Sales_Id]) when NULL THEN 0

ELSE COUNT([Sales ID]) END

• ###### 2. Re: Display Zero if Count Records is Zero - In Dashboard

Hello,

I tried your calculation and still does not return anything. I will take a closer look at the data and see if I can provide some more information.

Thank you for the response. Brent

• ###### 3. Re: Display Zero if Count Records is Zero - In Dashboard

Hi Brent,

You can try this formula to see if it displays 0.

zn(lookup(COUNT([Sales_Id]), 0))

Regards,

Eduardo

1 of 1 people found this helpful
• ###### 4. Re: Display Zero if Count Records is Zero - In Dashboard

Hello Eduardo,

With testing, I can see the formula works in a table when I am not filtering the salesperson ID. (correctly displays a zero).

All salespeople:

Filtered to 1 salesperson

But, as I apply the sales person's filter the category goes away

• I think this is the issue
• There is no category, so it won't display anything

Does this make sense? Thank you!

• ###### 5. Re: Display Zero if Count Records is Zero - In Dashboard

Just to provide some more details if someone is following this thread, there is a very good explanation to the ZN function HERE

it covers this topic but does not quite provide the solution to my problem.