# Lens color by value issue when using formula metrics

**URL:** <https://discuss.elastic.co/t/lens-color-by-value-issue-when-using-formula-metrics/384284>\
**Category:** Kibana\
**Tags:** lens\
**Created:** [December 27, 2025, 11:13pm UTC](https://discuss.elastic.co/t/lens-color-by-value-issue-when-using-formula-metrics/384284 "2025-12-27T23:13:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cgchamb](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cgchamb](https://discuss.elastic.co/u/cgchamb)\
**Post date:** [December 27, 2025, 11:13pm UTC](https://discuss.elastic.co/t/lens-color-by-value-issue-when-using-formula-metrics/384284/1 "2025-12-27T23:13:00Z")

</div>

Elasticsearch: 8.19.5, Kibana: 8.19.5.

I’m using the Sample Flight data set and I’ve created a Lens Table with “Rows: Top 5 values of Carrier” and Metric “Count of DestAirportID”. I set the metric to color by value (Cell) with value \>= 3000 as one color and anything less as another color. I can add more metrics with separate color options and the table works correctly, but as soon as I add a metric that uses a formula, it changes the coloring of other metrics. Example, I added a simple metric with formula “1+1” and this is the result:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/9/69759abcb90edecca419f64e3d76ecf9ba4b2e51.png)

---

<div class="post-metadata">

**Author:** ![cgchamb](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cgchamb](https://discuss.elastic.co/u/cgchamb)\
**Post date:** [December 27, 2025, 11:19pm UTC](https://discuss.elastic.co/t/lens-color-by-value-issue-when-using-formula-metrics/384284/2 "2025-12-27T23:19:01Z")

</div>

Elasticsearch: 8.19.5, Kibana: 8.19.5.

I’m using the Sample Flight data set and I’ve created a Lens Table with “Rows: Top 5 values of Carrier” and Metric “Count of DestAirportID”. I set the metric to color by value (Cell) with value \>= 3000 as one color and anything less as another color. I can add more metrics with separate color options and the table works correctly, but as soon as I add a metric that uses a formula, it changes the coloring of other metrics. Example, I added a simple metric with formula “1+1” and this is the result:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/9/69759abcb90edecca419f64e3d76ecf9ba4b2e51.png)

I did confirm that this was not a problem in 8.18.1 (we recently upgraded to 8.19.5)

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [December 28, 2025, 7:46am UTC](https://discuss.elastic.co/t/lens-color-by-value-issue-when-using-formula-metrics/384284/3 "2025-12-28T07:46:00Z")

</div>

Hello @cgchamb

Welcome to the Community!!

Tried on latest version of Elastic 9.2.3 and do not see this issue :

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0e2809e0f35f5bb8374f88e82f99f72664997ee5.png)

Yes in 8.19.5 it seems to be a bug :

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/0/602311b729017b46e0e12b02adea6dd2fa47672c.png)

But in the same session if you delete the formula and add again it works in 8.19.5 :

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

So ideally it is a bug but if you try to remove & add again in same session it works as above..can try as a temporary solution.

Thanks!!

---

<div class="post-metadata">

**Author:** ![cgchamb](https://avatars.discourse-cdn.com/v4/letter/c/b5ac83/32.png) [@cgchamb](https://discuss.elastic.co/u/cgchamb)\
**Post date:** [December 29, 2025, 12:17am UTC](https://discuss.elastic.co/t/lens-color-by-value-issue-when-using-formula-metrics/384284/4 "2025-12-29T00:17:07Z")

</div>

@Tortoise Thanks for your reply. The workaround you provided is not working for me. However, I did find a different workaround. I moved the formula metric above the “Count of DestAirportID” metric and now the coloring works. I added more metrics, and as long as I keep the formula metrics above non-formula, all the coloring works.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/2/92637dc7aec18382b96217ba8de6d1d7eb8b7531.png)
