# \#expressions

**URL:** https://community.grafana.com/tag/expressions/248.md

[Latest](https://community.grafana.com/latest.md) · [Categories](https://community.grafana.com/categories.md) · [Tags](https://community.grafana.com/tags.md)

---

## [How can I use a transformation in an expression?](https://community.grafana.com/t/how-can-i-use-a-transformation-in-an-expression/164039)

<div class="topic-metadata">

**Author:** [@ROView](https://community.grafana.com/u/ROView)\
**Replies:** 1\
**Last updated:** [August 4, 2026, 2:53am UTC](https://community.grafana.com/t/how-can-i-use-a-transformation-in-an-expression/164039 "2026-08-04T02:53:13Z")

</div>

Hello, I am have been manipulating data sets using transformations but have not had a way to use that transformation in an expression. Is there a way to add this transformation into a way that I can do math on it, or m…

---

## [Fill missing values with zero](https://community.grafana.com/t/fill-missing-values-with-zero/161995)

<div class="topic-metadata">

**Author:** [@jonathonrobinson](https://community.grafana.com/u/jonathonrobinson)\
**Replies:** 1\
**Last updated:** [March 23, 2026, 7:00am UTC](https://community.grafana.com/t/fill-missing-values-with-zero/161995 "2026-03-23T07:00:49Z")

</div>

I’ve been struggling with this problem for quite a while now. In any visualization that involves time, if a row is missing it’s a very frustrating experience to set that to zero. Unfortunately “Standard options \> No val…

---

## [SQL Expressions fail when source table has no rows](https://community.grafana.com/t/sql-expressions-fail-when-source-table-has-no-rows/159516)

<div class="topic-metadata">

**Author:** [@mattfenner](https://community.grafana.com/u/mattfenner)\
**Replies:** 0\
**Last updated:** [November 19, 2025, 2:09am UTC](https://community.grafana.com/t/sql-expressions-fail-when-source-table-has-no-rows/159516 "2025-11-19T02:09:11Z")

</div>

I don’t know if this counts as a bug or not, but I run into this every time I try to use the new SQL Expressions I hit the same problem. They work well in the normal case but they error when the source table has no rows. …

---

## [Create an alert from a Redis datasource list](https://community.grafana.com/t/create-an-alert-from-a-redis-datasource-list/155267)

<div class="topic-metadata">

**Author:** [@awenine](https://community.grafana.com/u/awenine)\
**Replies:** 1\
**Last updated:** [September 24, 2025, 3:49pm UTC](https://community.grafana.com/t/create-an-alert-from-a-redis-datasource-list/155267 "2025-09-24T15:49:14Z")

</div>

(using Grafana v12.0.2 running on Ubuntu) Hi all, I am trying to create an alert that triggers when the latest timestamp in a Redis datasource (stored as a LIST) is older than a certain amount (indicating that the serv…

---

## [No data from math expression which should join two sets of series on label subset](https://community.grafana.com/t/no-data-from-math-expression-which-should-join-two-sets-of-series-on-label-subset/155768)

<div class="topic-metadata">

**Author:** [@ssnover](https://community.grafana.com/u/ssnover)\
**Replies:** 1\
**Last updated:** [September 24, 2025, 10:53am UTC](https://community.grafana.com/t/no-data-from-math-expression-which-should-join-two-sets-of-series-on-label-subset/155768 "2025-09-24T10:53:46Z")

</div>

Hello, I’m trying to create a somewhat non-trivial alert which takes into account two different prometheus metrics. I have two metric queries A and B, and I’ve added further expressions to threshold them down to essentia…

---

## [Expression Math divide not working as expected](https://community.grafana.com/t/expression-math-divide-not-working-as-expected/147066)

<div class="topic-metadata">

**Author:** [@mornelsd](https://community.grafana.com/u/mornelsd)\
**Replies:** 2\
**Last updated:** [March 25, 2025, 8:32pm UTC](https://community.grafana.com/t/expression-math-divide-not-working-as-expected/147066 "2025-03-25T20:32:53Z")

</div>

In Grafana Cloud I have an Elasticsearch data source. I want to get a success percentage value displayed from 2 queries: A: count of all logs where the field ‘action’ equals ‘advance’ (total) B: count of all logs …

---

## [An Expression using metrics from a Query with multiple metrics](https://community.grafana.com/t/an-expression-using-metrics-from-a-query-with-multiple-metrics/146727)

<div class="topic-metadata">

**Author:** [@markhand](https://community.grafana.com/u/markhand)\
**Replies:** 0\
**Last updated:** [March 19, 2025, 8:39pm UTC](https://community.grafana.com/t/an-expression-using-metrics-from-a-query-with-multiple-metrics/146727 "2025-03-19T20:39:22Z")

</div>

What Grafana version and what operating system are you using? v11.3.2 on Linux What are you trying to achieve? I want to use a single Query on an elasticsearch data source to provide multiple metrics and then use th…

---

## [Expression Math operation does not give out decimal](https://community.grafana.com/t/expression-math-operation-does-not-give-out-decimal/146714)

<div class="topic-metadata">

**Author:** [@waczny](https://community.grafana.com/u/waczny)\
**Replies:** 0\
**Last updated:** [March 19, 2025, 3:58pm UTC](https://community.grafana.com/t/expression-math-operation-does-not-give-out-decimal/146714 "2025-03-19T15:58:57Z")

</div>

I have B1 with 3 and G1 with 341 and I get a rounded number back even so I ask for 1 decimal place. Any ideas to fix this?

---

## [Grafana Expressions Doesn't Work](https://community.grafana.com/t/grafana-expressions-doesnt-work/145854)

<div class="topic-metadata">

**Author:** [@rikutozumoko](https://community.grafana.com/u/rikutozumoko)\
**Replies:** 6\
**Last updated:** [March 9, 2025, 12:06pm UTC](https://community.grafana.com/t/grafana-expressions-doesnt-work/145854 "2025-03-09T12:06:44Z")

</div>

What Grafana version and what operating system are you using? V9.2.2 What are you trying to achieve? I Have a Expression Query ($2BAvailability + $2CAvailability) / 2 The expression is simply add the 2 query and the…

---

## [Problem with Expression](https://community.grafana.com/t/problem-with-expression/144474)

<div class="topic-metadata">

**Author:** [@ritheshms7](https://community.grafana.com/u/ritheshms7)\
**Replies:** 2\
**Last updated:** [February 20, 2025, 11:07am UTC](https://community.grafana.com/t/problem-with-expression/144474 "2025-02-20T11:07:05Z")

</div>

Hi, I have created a dashboard using infinity datasource. I have value from 2 queries as below, “where “Month” == ‘Jan’ | pivot count(“Month”)” “where “Month” == ‘Dec’ | pivot count(“Month”)” These two queries are re…

---

## [Calculation of values of influxdb query with different timestamp](https://community.grafana.com/t/calculation-of-values-of-influxdb-query-with-different-timestamp/143471)

<div class="topic-metadata">

**Author:** [@anonymouswebhacker](https://community.grafana.com/u/anonymouswebhacker)\
**Replies:** 2\
**Last updated:** [February 11, 2025, 10:36am UTC](https://community.grafana.com/t/calculation-of-values-of-influxdb-query-with-different-timestamp/143471 "2025-02-11T10:36:32Z")

</div>

I’m trying to add these values ​​and it gives me this warning. I was reading several threads on the internet, but this is with influxdb, and I am at a dead end. A from(bucket: "PSA") |\> range(start: v.timeRangeStart,…

---

## [Grafana variable, regex remove part of the response](https://community.grafana.com/t/grafana-variable-regex-remove-part-of-the-response/141714)

<div class="topic-metadata">

**Author:** [@bs43](https://community.grafana.com/u/bs43)\
**Replies:** 1\
**Last updated:** [January 30, 2025, 7:02am UTC](https://community.grafana.com/t/grafana-variable-regex-remove-part-of-the-response/141714 "2025-01-30T07:02:57Z")

</div>

I was trying to extract and remove a part of the response previously, when tried some expression i got the output which i need to remove. Expectation is to remove the (RAW). When trying this (?:RAW\\s+)?(.\*) we d…

---

## [Variables, Regex, to display part of the response](https://community.grafana.com/t/variables-regex-to-display-part-of-the-response/141531)

<div class="topic-metadata">

**Author:** [@bs43](https://community.grafana.com/u/bs43)\
**Replies:** 1\
**Last updated:** [January 28, 2025, 4:22pm UTC](https://community.grafana.com/t/variables-regex-to-display-part-of-the-response/141531 "2025-01-28T16:22:54Z")

</div>

So, in regex in variables, i need to display few completely and some response i need to display the part of the response And in regex, I must take that “Requests executed in background threads of” out and display res…

---

## [Sort bar gauge by value of expression](https://community.grafana.com/t/sort-bar-gauge-by-value-of-expression/138220)

<div class="topic-metadata">

**Author:** [@markhand](https://community.grafana.com/u/markhand)\
**Replies:** 5\
**Last updated:** [December 12, 2024, 5:07am UTC](https://community.grafana.com/t/sort-bar-gauge-by-value-of-expression/138220 "2024-12-12T05:07:26Z")

</div>

I want to display a bar gauge to show the percentage of “X” records for each team.name, so I have a visualization with: A (query): class: \* Group by: Terms: team.name B (query): class: X Group by: Terms: team.name C (e…

---

## [Alert Rules Math Expresion](https://community.grafana.com/t/alert-rules-math-expresion/137699)

<div class="topic-metadata">

**Author:** [@akshayc262](https://community.grafana.com/u/akshayc262)\
**Replies:** 1\
**Last updated:** [December 9, 2024, 9:33pm UTC](https://community.grafana.com/t/alert-rules-math-expresion/137699 "2024-12-09T21:33:25Z")

</div>

I have two expressions C and D. C: It is a reduce expression with LAST function for input query A, it gives me Series 1 and Series 2. D: It is also a reduce expression with LAST function for input query A, it gives m…

---

## [Perform a conditional calculation](https://community.grafana.com/t/perform-a-conditional-calculation/136877)

<div class="topic-metadata">

**Author:** [@Ayno](https://community.grafana.com/u/Ayno)\
**Replies:** 1\
**Last updated:** [November 23, 2024, 2:34am UTC](https://community.grafana.com/t/perform-a-conditional-calculation/136877 "2024-11-23T02:34:39Z")

</div>

Hello, Database used: InfluxDB I have three simple queries in flux language, with a one-day aggregation window. These three requests are then summed with Grafana with an expression: $A + $B + $C / $D. $D is a meteoro…

---

## [The AWS Cloudwatch PERIOD function (in expression) 5x smaller in 24hrs time range](https://community.grafana.com/t/the-aws-cloudwatch-period-function-in-expression-5x-smaller-in-24hrs-time-range/101693)

<div class="topic-metadata">

**Author:** [@skwokie](https://community.grafana.com/u/skwokie)\
**Replies:** 8\
**Last updated:** [October 15, 2024, 3:15pm UTC](https://community.grafana.com/t/the-aws-cloudwatch-period-function-in-expression-5x-smaller-in-24hrs-time-range/101693 "2024-10-15T15:15:35Z")

</div>

Grafana version: 9.5.6 and operating system: Alpine Linux v3.17 (docker container) What are you trying to achieve? Display AWS Opensearch 2xx response rate. How are you trying to achieve it? Http response codes…

---

## [Math expressions broken in AWS Grafana 10.4?](https://community.grafana.com/t/math-expressions-broken-in-aws-grafana-10-4/133227)

<div class="topic-metadata">

**Author:** [@bogdanlaban](https://community.grafana.com/u/bogdanlaban)\
**Replies:** 5\
**Last updated:** [September 30, 2024, 1:52pm UTC](https://community.grafana.com/t/math-expressions-broken-in-aws-grafana-10-4/133227 "2024-09-30T13:52:40Z")

</div>

I have no problems getting my panels to work when I query for cloudwatch ECS data. They display properly. However, when I try to do any math expressions on them, it breaks and throws the Query Error seen in the pic attac…

---

## [More than 1 expression on a graph is broken](https://community.grafana.com/t/more-than-1-expression-on-a-graph-is-broken/126471)

<div class="topic-metadata">

**Author:** [@whiskerlabsit](https://community.grafana.com/u/whiskerlabsit)\
**Replies:** 9\
**Last updated:** [July 31, 2024, 6:54pm UTC](https://community.grafana.com/t/more-than-1-expression-on-a-graph-is-broken/126471 "2024-07-31T18:54:19Z")

</div>

I have a time series graph panel where I have multiple expressions being calculated. Prior to what looks like a new system update, everything was working fine. Now it looks like I can only calculate one expression per pa…

---

## [Result of Math Expression is missing dimension value if one of the metric it is calculated from is missing it](https://community.grafana.com/t/result-of-math-expression-is-missing-dimension-value-if-one-of-the-metric-it-is-calculated-from-is-missing-it/125746)

<div class="topic-metadata">

**Author:** [@mvic](https://community.grafana.com/u/mvic)\
**Replies:** 0\
**Last updated:** [July 8, 2024, 3:32pm UTC](https://community.grafana.com/t/result-of-math-expression-is-missing-dimension-value-if-one-of-the-metric-it-is-calculated-from-is-missing-it/125746 "2024-07-08T15:32:51Z")

</div>

Hello everyone! I’m trying to create a dashboard with math expression calculated from several queries - Geneva metrics. I have 5 Geneva metrics (A, B, C, D, E). All of them have the dimension “region” with 3 possible v…

---

## [Mathematically combine multiple prom metrics with matching labels](https://community.grafana.com/t/mathematically-combine-multiple-prom-metrics-with-matching-labels/124758)

<div class="topic-metadata">

**Author:** [@tg44](https://community.grafana.com/u/tg44)\
**Replies:** 3\
**Last updated:** [June 25, 2024, 12:39pm UTC](https://community.grafana.com/t/mathematically-combine-multiple-prom-metrics-with-matching-labels/124758 "2024-06-25T12:39:17Z")

</div>

Hy! I have 2 prom metrics temperature and humidity. Both of these have a label sensor (like “livingroom”, “kitchen” etc. in them). Can I use any features in grafana to calculate a heat index (for a dummy example someth…

---

## [Error 500 when adding new expression](https://community.grafana.com/t/error-500-when-adding-new-expression/123539)

<div class="topic-metadata">

**Author:** [@bbrot381](https://community.grafana.com/u/bbrot381)\
**Replies:** 1\
**Last updated:** [June 8, 2024, 6:34pm UTC](https://community.grafana.com/t/error-500-when-adding-new-expression/123539 "2024-06-08T18:34:54Z")

</div>

Hi there, I’m having a bit of an issue with my query section. When I try to add a new expression, I get an error 500 straight away, even though I haven’t written anything in the expression field. I’ve looked in the tr…

---

## [Get Timespan for percentage](https://community.grafana.com/t/get-timespan-for-percentage/123401)

<div class="topic-metadata">

**Author:** [@mad](https://community.grafana.com/u/mad)\
**Replies:** 1\
**Last updated:** [June 6, 2024, 2:20pm UTC](https://community.grafana.com/t/get-timespan-for-percentage/123401 "2024-06-06T14:20:07Z")

</div>

Hello, I am using Grafana v10.4.1 (d3ce857c0e) for Windows. I want to calculate an percentage. The information is queried from an influx db via fluxx. For example I want to get the percentage of the time an machine i…

---

## [Grafana Alert Manager: I would like to use a threshold which is stored as label for the Alert, how is this possible?](https://community.grafana.com/t/grafana-alert-manager-i-would-like-to-use-a-threshold-which-is-stored-as-label-for-the-alert-how-is-this-possible/123191)

<div class="topic-metadata">

**Author:** [@alexanderschilling](https://community.grafana.com/u/alexanderschilling)\
**Replies:** 0\
**Last updated:** [June 4, 2024, 9:07am UTC](https://community.grafana.com/t/grafana-alert-manager-i-would-like-to-use-a-threshold-which-is-stored-as-label-for-the-alert-how-is-this-possible/123191 "2024-06-04T09:07:25Z")

</div>

I have results of time measuring (using blackbox exporter) in prometheus for different services. Now I want to implement an Alert if the service is slower than \<limit\_warn\> seconds. The limit has to differ for different…

---

## [Display the result of dividing TimeSeries-value by plain-SQL-query value within a single dashboard: No data](https://community.grafana.com/t/display-the-result-of-dividing-timeseries-value-by-plain-sql-query-value-within-a-single-dashboard-no-data/121397)

<div class="topic-metadata">

**Author:** [@fedorv](https://community.grafana.com/u/fedorv)\
**Replies:** 2\
**Last updated:** [May 14, 2024, 7:51am UTC](https://community.grafana.com/t/display-the-result-of-dividing-timeseries-value-by-plain-sql-query-value-within-a-single-dashboard-no-data/121397 "2024-05-14T07:51:50Z")

</div>

What Grafana version and what operating system are you using?\* Grafana Playground Grafana v11.1.0-69950 What are you trying to achieve? I need to display the result of dividing TimeSeries-value from Datasource 1 …

---

## [How to Alert based on Slope of Metric Graph?](https://community.grafana.com/t/how-to-alert-based-on-slope-of-metric-graph/83049)

<div class="topic-metadata">

**Author:** [@prithvi.b](https://community.grafana.com/u/prithvi.b)\
**Replies:** 6\
**Last updated:** [March 29, 2024, 3:35am UTC](https://community.grafana.com/t/how-to-alert-based-on-slope-of-metric-graph/83049 "2024-03-29T03:35:39Z")

</div>

I have an SQS Dead Letter Queue I am trying to alert on. Grafana is getting the data about this queue from Cloudwatch via the Cloudwatch connector. The queue’s behavior over the past week looks like this: I am tryi…

---

## [Expression not evaluated in Grafana v11.0.0-68547 but works on v10.4.1](https://community.grafana.com/t/expression-not-evaluated-in-grafana-v11-0-0-68547-but-works-on-v10-4-1/117901)

<div class="topic-metadata">

**Author:** [@bingyuyap](https://community.grafana.com/u/bingyuyap)\
**Replies:** 0\
**Last updated:** [March 26, 2024, 8:53am UTC](https://community.grafana.com/t/expression-not-evaluated-in-grafana-v11-0-0-68547-but-works-on-v10-4-1/117901 "2024-03-26T08:53:10Z")

</div>

What Grafana version and what operating system are you using? Grafana Enterprise v11.0.0-68547 (15122bc71c) What are you trying to achieve? I have a time series data, trying to apply a threshold expression to it. …

---

## [Expression does not deliver result](https://community.grafana.com/t/expression-does-not-deliver-result/116751)

<div class="topic-metadata">

**Author:** [@jaal](https://community.grafana.com/u/jaal)\
**Replies:** 2\
**Last updated:** [March 13, 2024, 9:51am UTC](https://community.grafana.com/t/expression-does-not-deliver-result/116751 "2024-03-13T09:51:21Z")

</div>

Hi, I’m using two selects: Select 1: SELECT spread(“Total\_in”) \*1000 FROM “power” WHERE $timeFilter Select 2: SELECT integral(“value”,1h) \* 1000 FROM “inverter\_pv\_power\_inverter” WHERE $timeFilter GROUP BY time(1d) fi…

---

## [Stat panel with fields selected by Regular expression](https://community.grafana.com/t/stat-panel-with-fields-selected-by-regular-expression/112744)

<div class="topic-metadata">

**Author:** [@markfree](https://community.grafana.com/u/markfree)\
**Replies:** 1\
**Last updated:** [January 25, 2024, 12:07pm UTC](https://community.grafana.com/t/stat-panel-with-fields-selected-by-regular-expression/112744 "2024-01-25T12:07:35Z")

</div>

Grafana 10.0.3 Zabbix data-source 4.4.0 Hey guys. I’m trying to display the status of several monitored Jobs using the Stat panel. To do this, I have created a query that can return various job-related data. Th…

---

## [Setting up alerts in Grafana](https://community.grafana.com/t/setting-up-alerts-in-grafana/111880)

<div class="topic-metadata">

**Author:** [@farhana1](https://community.grafana.com/u/farhana1)\
**Replies:** 0\
**Last updated:** [January 12, 2024, 4:59pm UTC](https://community.grafana.com/t/setting-up-alerts-in-grafana/111880 "2024-01-12T16:59:14Z")

</div>

My condition is to evaluate every 4 minutes, if the maximum value in the 4 minute time series data exceeds threshold value, it has to go to pending state which is 32 minutes, so in 32 minutes every 4 minutes evaluation o…

[Next page](https://community.grafana.com/tag/expressions/248.md?match_all_tags=true&page=1&tags%5B%5D=expressions)
