# Ranking in Lens Formula Features Visualization

**URL:** <https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [March 1, 2023, 1:51am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718 "2023-03-01T01:51:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)\
**Post date:** [March 1, 2023, 1:51am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/1 "2023-03-01T01:51:13Z")

</div>

Hi,

I have problem in ranking my visualization dashboard.

I would like to visualize Top 10 Uptime Monitor Availability.

I already tried using the TVSB visualization type which is Top N to visualize Top 10 Uptime Monitor, and using the Filter Ratio to display my Uptime Availability percentage.

However, the Uptime Availability percentage seems wrong.

 ![Top N Visualization](https://us1.discourse-cdn.com/elastic/original/3X/e/e/ee20a716e27933aa76a55c207dc3354775a0fd90.png)

Thus, I use the Lens visualization which is Bar horizontal type to visualize my data.

I use the Formula features to calculate my Uptime percentage and the data is displaying correctly.

However, I would like to rank my Uptime Availability Formula that I already created in ascending order, but I unable to do so.

 ![Formula KQL Rank](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4ca97061a92ea72607ecf795bcdf8a0b53af8fe7.png)

It seems like I only able to rank it by Vertical Axis which is not meaningful to me as I would like to rank my Uptime Formula that I already created in Horizontal Axis.

 ![Rank by Vertical Axis](https://us1.discourse-cdn.com/elastic/original/3X/5/8/5842bb830c9e08e77beaba154b109b80abadd1ef.png)

Is there any KQL syntax for ranking it by ascending order that I could apply in my Uptime Availability Formula ? Or is there any other options I could rank my Uptime Availability Formula in ascending order?

Thank you.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 1, 2023, 2:54am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/2 "2023-03-01T02:54:53Z")

</div>

Yeah, that is an issue in Lens... What version are you on?

I think the rank by the formula is on the roadmap but it is not there today

---

<div class="post-metadata">

**Author:** ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)\
**Post date:** [March 1, 2023, 3:12am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/3 "2023-03-01T03:12:13Z")

</div>

Hi Stephen,

Thank you for your reply.

I see so that is an issue in Lens. I'm in version 8.6.1.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 1, 2023, 3:16am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/4 "2023-03-01T03:16:31Z")

</div>

Yeah I tried 8.6.2... still not there...

Strangely the Pie Chart seems to give a better representation today, but yes I like the Horizontal Top-N better for a number of use cases.

 ![Screen Shot 2023-02-28 at 7.12.50 PM](https://us1.discourse-cdn.com/elastic/original/3X/8/2/82891f2dba415d3a37af583bd2cc4f6dea8d352e.png)

On the TSVB go into the panel option and try setting Full Time Range .. .otherwise the calculation is just using the last bucket which for 15 Munites is like the last 30 seconds

 ![Screen Shot 2023-02-28 at 7.14.53 PM](https://us1.discourse-cdn.com/elastic/original/3X/f/b/fbff16a154a67d8902c5622b07df443585fc39b8.png)

---

<div class="post-metadata">

**Author:** ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)\
**Post date:** [March 1, 2023, 5:39am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/5 "2023-03-01T05:39:08Z")

</div>

I see the ranking features still not there.

Already set the Top-N data as the entire time range before this, not sure why the calculation from my Lens Formula and the Filter Ratio is not the same.

 ![Screenshot 2023-03-01 at 1.23.21 PM](https://us1.discourse-cdn.com/elastic/original/3X/d/a/da052a09e9e386ecb88b73a203d53d8288ba3788.png)

The 100% Uptime Percentage is the one I use Lens formula to calculate the Uptime Availability and the Top-N percentage ones is not the same.

 ![Screenshot 2023-03-01 at 1.26.56 PM](https://us1.discourse-cdn.com/elastic/original/3X/3/a/3aa334a83e63aba3cd4d4260df9c9b249d5db35a.png)  
 ![Screenshot 2023-03-01 at 1.27.03 PM](https://us1.discourse-cdn.com/elastic/original/3X/1/1/1130ead739ff2a6166895cb08a53cd1ae874f344.png)

I believe that Filter Ratio is an aggregation to display percentage.  
Not sure why the value is not the same.

 ![Screenshot 2023-03-01 at 1.27.22 PM](https://us1.discourse-cdn.com/elastic/original/3X/3/c/3cd71343775cfd0bfc7ba1df770699f504fb0bc6.png)  
 ![Screenshot 2023-03-01 at 1.33.23 PM](https://us1.discourse-cdn.com/elastic/original/3X/a/9/a983bab499b755a1db7bd245add13ca6f7f9e4ea.png)

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [March 1, 2023, 8:30am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/6 "2023-03-01T08:30:40Z")

</div>

Hi @aisyaharifin

unfortunately it is not possible to rank by a formula due to some technical challenges, same applies also for other calculations like moving averages and differences.  
As a workaround in Lens has been introduced the custom metric ranking (like the agg-based editor had).

---

<div class="post-metadata">

**Author:** ![aisyaharifin](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@aisyaharifin](https://discuss.elastic.co/u/aisyaharifin)\
**Post date:** [March 2, 2023, 12:58am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/7 "2023-03-02T00:58:28Z")

</div>

Hi Marco,

Thank you for your reply, but I'm sorry I didn't quite get you. Does this mean that I could not rank my Lens Formula due to the technical challenges?

Is this because Lens has introduced the custom metric ranking as in the image below?

 ![Rank by Vertical Axis](https://us1.discourse-cdn.com/elastic/original/3X/5/8/5842bb830c9e08e77beaba154b109b80abadd1ef.png)

---

<div class="post-metadata">

**Author:** ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)\
**Post date:** [March 2, 2023, 7:58am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/8 "2023-03-02T07:58:12Z")

</div>

Lens formula happens on the client side, so the server cannot know the final metric in order to rank.  
The custom metric workaround is a way to handle some of these cases, but I understand it won't cover all of them.

---

<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:** [March 30, 2023, 7:59am UTC](https://discuss.elastic.co/t/ranking-in-lens-formula-features-visualization/326718/9 "2023-03-30T07:59:07Z")

</div>

Closed on March 30, 2023, 7:59am UTC

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