# Compare 2 days Data and conditional formatting

**URL:** https://discuss.elastic.co/t/compare-2-days-data-and-conditional-formatting/324860
**Category:** Kibana
**Tags:** lens, kql-kibana-query-language
**Created:** [February 7, 2023, 6:39am UTC](https://discuss.elastic.co/t/compare-2-days-data-and-conditional-formatting/324860 "2023-02-07T06:39:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://discuss.elastic.co/u/Raj4)
#### Post date: [February 7, 2023, 6:39am UTC](https://discuss.elastic.co/t/compare-2-days-data-and-conditional-formatting/324860/1 "2023-02-07T06:39:25Z")

</div>

Hi,

I am new to Kibana, I have a requirement to compare 2 days of data and create visualization. (Kibana Version 7.10)

## Day 1 Data

Nam Col1 Col2  
AAA 500 600  
BBB 700 800

## Day 2 Data

Nam Col1 Col2  
AAA 400 700  
BBB 900 900

Comparison and Visualization should satisfy the below

1. If Day 1 value is Less than Day 2 Data, then display Day 2 data in RED
2. If Day 1 value is greater than Day 2 Data, then display Day 2 data in GREEN

Kindly assist me

## Final Visualization should be as follow , (R/G) the value / the cell should be in Red/green Result Data

Nam Col1 Col2  
AAA 400(R) 700(G)  
BBB 900(G) 900(G)

Thanks

---

<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: [February 7, 2023, 8:43am UTC](https://discuss.elastic.co/t/compare-2-days-data-and-conditional-formatting/324860/2 "2023-02-07T08:43:37Z")

</div>

Hi @Raj4

with newer version of Kibana you can do something closer, but not that exactly.  
I would suggest to build a table like the following with a time range of "Today" (or 1 day):

```auto
Name | Col1 | Col1 color | Col2 | Col2 color
AAA | 400. | Red. | 700. | Green
BBB | 900 | Green. | 900. | Green

```

For Col1 and Col2 you might use the `max` operation.  
For the `Col1 color` and `Col2 color` you might use the following formula:

```auto
max( Col1 ) / max( Col1, shift="1d")

```

And then use the color by value feature to set the green/red color if the value is \> 1 (green) or \<1 (red).

---

<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: [February 16, 2023, 5:25pm UTC](https://discuss.elastic.co/t/compare-2-days-data-and-conditional-formatting/324860/3 "2023-02-16T17:25:48Z")

</div>

Kibana Version 7.10 is [EOL](https://www.elastic.co/support/eol) and no longer supported. Please upgrade ASAP.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

---

<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 16, 2023, 5:26pm UTC](https://discuss.elastic.co/t/compare-2-days-data-and-conditional-formatting/324860/4 "2023-03-16T17:26:39Z")

</div>

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