# Using math in Kibana visulisations

**URL:** <https://discuss.elastic.co/t/using-math-in-kibana-visulisations/230517>\
**Category:** Kibana\
**Created:** [April 30, 2020, 10:21am UTC](https://discuss.elastic.co/t/using-math-in-kibana-visulisations/230517 "2020-04-30T10:21:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oggy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oggy/32/65184_2.png) [@Oggy](https://discuss.elastic.co/u/Oggy)\
**Post date:** [April 30, 2020, 10:21am UTC](https://discuss.elastic.co/t/using-math-in-kibana-visulisations/230517/1 "2020-04-30T10:21:05Z")

</div>

Hello, I have a bit of a weird thing to ask here. We have a system where customer by buying products gets stars, after the user has 6 stars he can use them for a discount.

We log every time the user gains a star in Kibana, we also log how much stars he has at the moment user has gained one. I need to make a chart that displays how many users we have that have :  
1 Star 3 Stars 5 Stars  
2 Stars 4 Stars 6 Stars

But when I do that I notice the visualization also counts the user that has 5 stars as if he also had 1,2,3,4 (because the log still exists), is there a way for me to subtract from the 1 star total all of the other star totals so that I get correct data ? If you need further info I will share to you the logs.

Thanks

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [May 4, 2020, 9:17pm UTC](https://discuss.elastic.co/t/using-math-in-kibana-visulisations/230517/2 "2020-05-04T21:17:23Z")

</div>

Hello,

I think maybe a derivative aggregation, spliting the bucket by stars and sorting them from min to max.  
This way you would display users that have each number of stars. It would show 1, nubmer of users that have 2 but not 1, number of users that have 3 and not 2.  
Can you try with that and let me know if it works?

---

<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:** [June 1, 2020, 9:17pm UTC](https://discuss.elastic.co/t/using-math-in-kibana-visulisations/230517/3 "2020-06-01T21:17:32Z")

</div>

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