Dynamic threshold calculated from variable

  • What Grafana version and what operating system are you using?
    Grafana cloud

  • What are you trying to achieve?
    to create a dynamic threhold = $number_of_month * 9%

  • How are you trying to achieve it?
    I have two columns, one is the monthly usage% and the other YTD usage%. I want to show the background color for the month usage% blue if <9%, if >=9%, show red color. But for YTD% for 2nd month(Feb), if <18%, blue, >=18% show red. But for the 3rd month, YTD’s threshold should be changed to 9% * 3 =27%… 4th month: 36%…

  • What happened?
    Not sure how to do this for YTD threshold as it is dynamics based on which month of the year?

  • What did you expect to happen?
    expect the threshold value can take the variable to become dynamic

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

Threshold is on the column level, not on the row, so you can’t do that.
Idea about similar solution (but not exactly what you asked, so don’t blame me pls - just improve it for your needs):
implement your required business logic on the query level and create new column with only values, which code color, e.g. 1 (blue), 2 (red) and then set threshold on that new column.

Hi @jangaraj , thanks for the suggestion. For my requirement, it should be just column level not the row level. We can ignore the monthly utilization, just focus on YTD utilization. I want to threshold can be dynamic based on the variable(ex:the month of the year) I set in the dashboard level. Then multiply with a constant value(ex: 0.09).

If it is January, the threshold should be 1 * 0.09=0.09. If in February(2nd month of year), the threshold should be 2 * 0.09=0.18 …, March 0.27, April: .036…

I think create a new column with color code would work, but not sure if I can show the color still in YTD% column based on the new column value or can only show the color on the new column.