I am trying to create a chart which shows the count of rows.
I apply specific filters requried on top of the data. Sometimes, due to the filters, there won't be any records left in the result. Due to this, when I apply Count() operation on top of it, it shows "No results found".
I want the output to be 0 when that happens. How can I do this?
Don’t specify a group-by column in the Summarize line. It will try to count all rows and get zero. Otherwise the count returns no rows as there is no category to report counts for.
For example, if you run this, you get 0 as a result:
But if you run it like this, you get No Results:
So I’ve been doing the same
This is the custom model I’m creating
And this is the chart question which is built using the above definde custom model
as you’ve mentioned, I’m not using group by at any place. The filter provided in the chart question returns 0 records. So, count should give me 0 but instead it shows result not found.
Hm, I’m having trouble reproducing this using the sample database. I even tried making a broken model (that always returns 0 rows) and it still reports a 0 count.
If you remove the Summarize line, do you still get the ‘No results’ message? (Checking for if we’re getting a bunch of NULL rows.)
What database engine is your model querying? And what Metabase version are you running?
Yes, even when there is no summarize line, it shows ‘No Results’. We are using MongoDB in the background. The metabase version I’m on is 1.55.7
Ah, MongoDB.
This result is by design, their count aggregate function does not return any value when the input document count is zero.
The workaround is to select an unrelated document that has the predicate ID in it (organizationID in your case) so you get some result, then use $lookup or $facet to join the count of the documents you’re looking for. The pattern is explained in this Stack Overflow post. I don’t know how to translate this into Metabase-ese, I only speak SQL right now, sorry.
Ahh that’s the problem now. I did try with facet option but I had to build the charts with native queries. And using native query will compramise the drill-into feature of metabase. So unfortunately I have to rely on metabase UI question builder and figure something out. 
NOTE: I was able to get 0 count results till friday last week. Today I opened my workspace to start working and boom I find this 