# Position(or numeric ranking) of a item in an aggreagation

**URL:** <https://discuss.elastic.co/t/position-or-numeric-ranking-of-a-item-in-an-aggreagation/279479>\
**Category:** Kibana\
**Created:** [July 23, 2021, 12:43pm UTC](https://discuss.elastic.co/t/position-or-numeric-ranking-of-a-item-in-an-aggreagation/279479 "2021-07-23T12:43:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pablo\_Albertengo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pablo_albertengo/32/47685_2.png) [@Pablo\_Albertengo](https://discuss.elastic.co/u/Pablo_Albertengo)\
**Post date:** [July 23, 2021, 12:43pm UTC](https://discuss.elastic.co/t/position-or-numeric-ranking-of-a-item-in-an-aggreagation/279479/1 "2021-07-23T12:43:11Z")

</div>

Hi!  
I have this problem.

Suppose I have an index to store products sales.  
And I want to define a visualization (potentially a table) with the following information:  
Product Name, ranking in number of units sold, ranking in total amount of sales.

Example

- Product A, 1st in number of units sold, 3rd in total sales amount

Is the problem understood?

Do I have a way to do it through Kibana / Elastic?

Thanks in advance,  
Pablo

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [July 24, 2021, 12:24am UTC](https://discuss.elastic.co/t/position-or-numeric-ranking-of-a-item-in-an-aggreagation/279479/2 "2021-07-24T00:24:29Z")

</div>

Can you provide an example or visual mockup of what you are trying to achieve?

Are you looking to create intervals of number of units sold (range aggregation), and then sort products by sales within that interval (top hits)? You can do that in Lens with a data table visualization:

> **[Lens | Kibana Guide \[7.13\] | Elastic](https://www.elastic.co/guide/en/kibana/current/lens.html)**

If you are looking for non-aggregated data, then the secondary sort only applies when multiple products are tied in ranking of the same number of units sold.

---

<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:** [August 21, 2021, 12:25am UTC](https://discuss.elastic.co/t/position-or-numeric-ranking-of-a-item-in-an-aggreagation/279479/3 "2021-08-21T00:25:19Z")

</div>

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