# Plot when count is zero

**URL:** <https://discuss.elastic.co/t/plot-when-count-is-zero/298692>\
**Category:** Kibana\
**Created:** [March 3, 2022, 3:59am UTC](https://discuss.elastic.co/t/plot-when-count-is-zero/298692 "2022-03-03T03:59:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic21](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@elastic21](https://discuss.elastic.co/u/elastic21)\
**Post date:** [March 3, 2022, 3:59am UTC](https://discuss.elastic.co/t/plot-when-count-is-zero/298692/1 "2022-03-03T03:59:24Z")

</div>

Is there a way to plot time series graph so that there are bars when records count is 0 and no bars when records count is \> 0 ? Given a time interval is selected for plotting (say 30min) for the data in last 24hrs ?

So, essentially showing when there was no data.

---

<div class="post-metadata">

**Author:** ![majagrubic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/majagrubic/32/74459_2.png) [@majagrubic](https://discuss.elastic.co/u/majagrubic)\
**Post date:** [March 3, 2022, 9:04am UTC](https://discuss.elastic.co/t/plot-when-count-is-zero/298692/2 "2022-03-03T09:04:49Z")

</div>

I'm afraid that's not possible. How would the bar look like when record count is 0 if it were to have height?

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [March 3, 2022, 2:22pm UTC](https://discuss.elastic.co/t/plot-when-count-is-zero/298692/3 "2022-03-03T14:22:16Z")

</div>

That's an interesting case, I think that is technically possible with some Lens formula magic.

In this example I've used two filters: in one case there's a file extensions that does not exists in the dataset, in the other case "css", which is known to be there.

 ![Screenshot 2022-03-03 at 15.16.52](https://us1.discourse-cdn.com/elastic/original/3X/7/b/7bcdede171da337934cafae6c67260acea3b2214.png)

For the metric side I've using this formula:

```auto
-1 * clamp(count(), 0, 1) + 1

```

Perhaps a table would suffice as well:

 ![Screenshot 2022-03-03 at 15.21.43](https://us1.discourse-cdn.com/elastic/original/3X/d/7/d7f02b46d507415210d9caa71e2917decf75f9c8.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 31, 2022, 2:22pm UTC](https://discuss.elastic.co/t/plot-when-count-is-zero/298692/4 "2022-03-31T14:22:22Z")

</div>

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