# TSVB Aggregation Count Filters

**URL:** <https://discuss.elastic.co/t/tsvb-aggregation-count-filters/359613>\
**Category:** Kibana\
**Tags:** visualisation\
**Created:** [May 16, 2024, 10:44am UTC](https://discuss.elastic.co/t/tsvb-aggregation-count-filters/359613 "2024-05-16T10:44:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![darrenkealey](https://avatars.discourse-cdn.com/v4/letter/d/f19dbf/32.png) [@darrenkealey](https://discuss.elastic.co/u/darrenkealey)\
**Post date:** [May 16, 2024, 10:44am UTC](https://discuss.elastic.co/t/tsvb-aggregation-count-filters/359613/1 "2024-05-16T10:44:58Z")

</div>

Hello

I want to be be able to perform a math aggregation that will divide variable A by B.

Variable A: I want to be able to use the count aggregation but filter by only the documents that have a certain field, I've looked at filter ratio for this but I'm not sure if this would work for this as both a numerator and denominator field will only provide a decimal value and not the actual count of the records.

Variable B: This will just be a regular sum aggregation.

I may be missing something but would be good to hear suggestions for this to get the filtered count value for variable A 🙂

Im able to perform this calculation in the lens formula section using:

count(kql='event.name: "value.a"')/sum(field.b)

---

<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:** [February 18, 2025, 1:39pm UTC](https://discuss.elastic.co/t/tsvb-aggregation-count-filters/359613/2 "2025-02-18T13:39:44Z")

</div>

Hi @darrenkealey

is there a specific reason to use this in TSVB rather than Lens?
