# Doing math on the content of unique counts

**URL:** <https://discuss.elastic.co/t/doing-math-on-the-content-of-unique-counts/26834>\
**Category:** Kibana\
**Created:** [August 4, 2015, 10:04pm UTC](https://discuss.elastic.co/t/doing-math-on-the-content-of-unique-counts/26834 "2015-08-04T22:04:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdunbar](https://avatars.discourse-cdn.com/v4/letter/b/a3d4f5/32.png) [@bdunbar](https://discuss.elastic.co/u/bdunbar)\
**Post date:** [August 4, 2015, 10:04pm UTC](https://discuss.elastic.co/t/doing-math-on-the-content-of-unique-counts/26834/1 "2015-08-04T22:04:25Z")

</div>

(The following is a little contrived, but is a simplification of what I'm really after. Hopefully it didn't loose meaning when I abstracted the content, but man: it was really messy to read)

A. I have a field, Foo. I want to calculate the value of unique Foo per hour.

Create visualization, Bar, with Aggregation=Unique Count on that field, over an absolute range 07:00 - 08:00 and things are looking good.

So far, so good.

B. The Wrinkle: I want the sum of Foos per hour across the day.

(example)  
value - time  
38 - 07:00 - 08:00  
46 - 08:00 - 09:00  
80 - 09:00 - 10:00

Equals 164 for 3 hours.

Now, I could tell the marketing guys to break out their calculators, but I'm really hoping I can coerce kibana into doing arithmetic on the contents of unique counts ...

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [August 5, 2015, 6:21am UTC](https://discuss.elastic.co/t/doing-math-on-the-content-of-unique-counts/26834/2 "2015-08-05T06:21:30Z")

</div>

Could you use two visualizations - one with the data table broken out by hour, one with a single sum metric - on the same dashboard?

 ![](https://us1.discourse-cdn.com/elastic/original/2X/b/bb3b443cc57ae724e9f6c1d1178a7c6b221c5097.png)

 ![](https://us1.discourse-cdn.com/elastic/original/2X/0/0aa1da52ae84a6da881ffdc00a57d27967c69009.png)

---

<div class="post-metadata">

**Author:** ![bdunbar](https://avatars.discourse-cdn.com/v4/letter/b/a3d4f5/32.png) [@bdunbar](https://discuss.elastic.co/u/bdunbar)\
**Post date:** [August 5, 2015, 6:36pm UTC](https://discuss.elastic.co/t/doing-math-on-the-content-of-unique-counts/26834/3 "2015-08-05T18:36:34Z")

</div>

Let me try that. I _think_ a problem I had yesterday was that the math didn't work out but .. that was yesterday.

---

<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:** [July 6, 2017, 2:15pm UTC](https://discuss.elastic.co/t/doing-math-on-the-content-of-unique-counts/26834/4 "2017-07-06T14:15:12Z")

</div>


