Conditional formatting in the table panel

Dear Grafana Team,

I would like to request a feature for the Grafana Table Panel.

Currently, conditional formatting (like coloring a cell background) can only be applied based on the value of the same field.
It is not possible to compare two fields (example: if Actual Sales < Target Sales) and then apply coloring based on that.
Feature Request:
Enable conditional formatting where we can compare two fields in a table panel, and apply background color or text color based on that comparison.

Example Use Case:

Show Actual Sales and Target Sales columns.

If Actual Sales is less than Target Sales, color the Actual Sales cell red.

Otherwise, keep it normal or green.

This feature would be very helpful for many business dashboards where targets vs actuals need to be visualized cleanly without extra calculated fields.

Thank you for considering this!

1 Like

Hi,

If you need it now, you can achieve it by:

  1. Calculating the difference by hand between those two fields and then applying some operation that will return special value from negative numbers (like ln will return Nan).

    You’ll be left with two more columns but we can hide them later.
  2. Go to value mapping and create a value mapping like this:

    Since ln can be calculated for all non-negative numbers, you’ll have either some number or the Nan, which will be colored in red.
  3. For coloring, use this option:
  4. To hide the additional fields, use such override

I realise that this is far from ideal, but I think it’s a nice workaround.

2 Likes