# TSVB - Sum of value for unique records

**URL:** https://discuss.elastic.co/t/tsvb-sum-of-value-for-unique-records/282967
**Category:** Kibana
**Created:** [August 31, 2021, 11:02pm UTC](https://discuss.elastic.co/t/tsvb-sum-of-value-for-unique-records/282967 "2021-08-31T23:02:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Athul\_Devkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/athul_devkar/32/93241_2.png) [@Athul\_Devkar](https://discuss.elastic.co/u/Athul_Devkar)
#### Post date: [August 31, 2021, 11:02pm UTC](https://discuss.elastic.co/t/tsvb-sum-of-value-for-unique-records/282967/1 "2021-08-31T23:02:27Z")

</div>

Is there anyway I can filter unique records and then find the sum of value for those unique records?

Data example:  
Order# - TotalMRC  
O101 - $120  
O101 - $120(duplicate record)  
O102 - $130  
O103 - $120

Expected result:  
120 + 130+ 120 = 370

For the above example how do I find the sum of total MRC for unique orders in TSVB?

End Result:

![image](https://us1.discourse-cdn.com/elastic/original/3X/d/4/d40c1a2d01647a74d8cb9323d74e2ae4f3e4802e.png)

---

<div class="post-metadata">

### Author: ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)
#### Post date: [August 31, 2021, 11:33pm UTC](https://discuss.elastic.co/t/tsvb-sum-of-value-for-unique-records/282967/2 "2021-08-31T23:33:39Z")

</div>

I'm having a hard time getting it done in TSVB, but it is possible using the aggregation-based visualizations:

1. Under "Metrics", select "Sum Bucket"
2. Under "Bucket", select "Terms"
3. Under "Field", select "Order#" (or whatever the name of this field is)
4. Under "Metric", select "Max" (or "Min", assuming all values for TotalMRC are the same)
5. Under "Field", select "TotalMRC"

You should end up with something that looks like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/8/a89135e38ab67844f50bd14acf2f9e0264537779.png)

Let me know if that helps!

---

<div class="post-metadata">

### Author: ![Athul\_Devkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/athul_devkar/32/93241_2.png) [@Athul\_Devkar](https://discuss.elastic.co/u/Athul_Devkar)
#### Post date: [September 1, 2021, 12:29am UTC](https://discuss.elastic.co/t/tsvb-sum-of-value-for-unique-records/282967/3 "2021-09-01T00:29:39Z")

</div>

Thanks for your reply!! Appreciate the quick solution. I tried your solution and it works. However, one of the reasons(apart from the background color - **btw can we do that in agg based viz?** ) I went for TSVB is that it had the 'Math' option which was really helpful in doing basic multiplication which I was not able to find in agg based visualization. Is it possible?

Please let me know. Thanks again!!!

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/8/08bc3f842c27b4d1c6be1a47c5ecb449627e28c5.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: [September 29, 2021, 12:30am UTC](https://discuss.elastic.co/t/tsvb-sum-of-value-for-unique-records/282967/4 "2021-09-29T00:30:32Z")

</div>

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