# Is it possible to create sum of counter\_rate across implicit dimensions

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-create-sum-of-counter-rate-across-implicit-dimensions/318343>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [November 7, 2022, 2:56pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-sum-of-counter-rate-across-implicit-dimensions/318343 "2022-11-07T14:56:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wiki.warx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wiki.warx/32/107336_2.png) [@wiki.warx](https://discuss.elastic.co/u/wiki.warx)\
**Post date:** [November 7, 2022, 2:56pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-sum-of-counter-rate-across-implicit-dimensions/318343/1 "2022-11-07T14:56:47Z")

</div>

I have metric reported from application (let's call it) **tasks**. This metric is reported as counter by multiple instances of application. In addition this metric is reported per **clientid** and per **userid** (both are UUIDs).

I need to have one metric that describes overall performance of application as sum of rates of this metric across all dimensions.

Is it even possible?

I found following solution: `counter_rate(sum(tasks))` but **it is plain wrong**. First of all it's not stable (when one instance resets counters counter\_rate can't detect it) and second it needs to have scaling factor because sum() sums not only across possible dimensions but also across time.

What I actually need is function`rate()` that calculates rates for all dimensions and then sum it.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 7, 2022, 3:33pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-sum-of-counter-rate-across-implicit-dimensions/318343/2 "2022-11-07T15:33:38Z")

</div>

We are aware of this being complicated at the moment and working on a solution that will make it as simple as picking a "rate" function and be done.

For now, at least in xy chart and table you are able to break down by the fields defining your series (clientid and userid in this case), calculating the counter rate for each series separately, then summing them up again:

 ![Screenshot 2022-11-07 at 16.31.03](https://us1.discourse-cdn.com/elastic/original/3X/c/5/c571e71e30975de5d3291501b260008f05783d39.png)

See under "appearance" the "Collapse by" setting. Does this help with your use case?

---

<div class="post-metadata">

**Author:** ![wiki.warx](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wiki.warx/32/107336_2.png) [@wiki.warx](https://discuss.elastic.co/u/wiki.warx)\
**Post date:** [November 7, 2022, 3:35pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-sum-of-counter-rate-across-implicit-dimensions/318343/3 "2022-11-07T15:35:39Z")

</div>

Hey! Thank you for your prompt response, I will check if this works for me - I forgot to mention that cardinality of this data is in order of hundreds of thousands...

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [November 7, 2022, 3:45pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-sum-of-counter-rate-across-implicit-dimensions/318343/4 "2022-11-07T15:45:28Z")

</div>

Ah good point, it won't work for hundreds of thousands separate series as you can't fetch this much information (the collapsing is done in the browser client)

---

<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:** [December 5, 2022, 3:46pm UTC](https://discuss.elastic.co/t/is-it-possible-to-create-sum-of-counter-rate-across-implicit-dimensions/318343/5 "2022-12-05T15:46:04Z")

</div>

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