# Metric background change based on last week value

**URL:** <https://discuss.elastic.co/t/metric-background-change-based-on-last-week-value/345082>\
**Category:** Kibana\
**Created:** [October 16, 2023, 9:16am UTC](https://discuss.elastic.co/t/metric-background-change-based-on-last-week-value/345082 "2023-10-16T09:16:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gnorillo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gnorillo/32/126545_2.png) [@gnorillo](https://discuss.elastic.co/u/gnorillo)\
**Post date:** [October 16, 2023, 9:16am UTC](https://discuss.elastic.co/t/metric-background-change-based-on-last-week-value/345082/1 "2023-10-16T09:16:52Z")

</div>

Hi everyone,

i would add a metric visualization to my dashboard with background colors based on a another metric (for example to compare same hour last week)

some example to explain:

if metric last hour is \>= metric last hour of last week than background green  
if metric last hour is -25% than metric last hour of last week = background yellow  
....

how could i do this?

---

<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:** [October 16, 2023, 4:40pm UTC](https://discuss.elastic.co/t/metric-background-change-based-on-last-week-value/345082/2 "2023-10-16T16:40:33Z")

</div>

Hi @gnorillo, Welcome to the community.

What version are you on?

If you are on a recent version, you can Use Lens to do this.

Metric  
Custom Formula with Shift  
something like

```auto
average(system.cpu.total.pct) - average(system.cpu.total.pct, shift='7d')

```

Then Line and Colorize

 ![Screenshot 2023-10-16 at 9.39.00 AM](https://us1.discourse-cdn.com/elastic/original/3X/9/8/98c0311808d95f3eafea2a60ac89f2b02e1c2b61.jpeg)

 ![Screenshot 2023-10-16 at 9.39.07 AM](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4ed8e9cd7f0e55f89c3606c2095f55c62392bac1.png)

 ![Screenshot 2023-10-16 at 9.39.14 AM](https://us1.discourse-cdn.com/elastic/original/3X/6/b/6b2384e0d4230a90472c7d89713acdb2b990908f.png)

---

<div class="post-metadata">

**Author:** ![gnorillo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gnorillo/32/126545_2.png) [@gnorillo](https://discuss.elastic.co/u/gnorillo)\
**Post date:** [October 17, 2023, 6:32am UTC](https://discuss.elastic.co/t/metric-background-change-based-on-last-week-value/345082/3 "2023-10-17T06:32:50Z")

</div>

hi @stephenb

thanks a lot for your reply.

i have v 7.9.2 version, but i don't see all the stuff in your screenshot.

it could be for basic license?

---

<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:** [October 17, 2023, 2:24pm UTC](https://discuss.elastic.co/t/metric-background-change-based-on-last-week-value/345082/4 "2023-10-17T14:24:29Z")

</div>

Hi @guerilla

Version 7.9 is incredibly old and the new Lens feature is not available.

I'm not sure if there's a readily available method to do that in 7.9.

You can look at TSVB but I am not sure if it supports the "shift" comparison feature.

The latest version is 8.10 ... Putting you more than **3 years!** behind and nearly 20 significant releases behind.

---

<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:** [November 14, 2023, 2:24pm UTC](https://discuss.elastic.co/t/metric-background-change-based-on-last-week-value/345082/5 "2023-11-14T14:24:32Z")

</div>

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