# Math based on another panel

**URL:** <https://community.grafana.com/t/math-based-on-another-panel/144021>\
**Category:** InfluxDB\
**Created:** [February 17, 2025, 12:20am UTC](https://community.grafana.com/t/math-based-on-another-panel/144021 "2025-02-17T00:20:36Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![cameron200sx](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@cameron200sx](https://community.grafana.com/u/cameron200sx)\
**Post date:** [February 17, 2025, 12:20am UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/1 "2025-02-17T00:20:36Z")

</div>

Not sure this is possible but my situation is that I have 2 queries and 5 transformations just to get the result I need from InfluxDB using InfluxQL. This result is only half the equation. What I then need is another set of queries and transformations to get another number and perform some maths with using the first number I described.

I want to get a total of multiple columns, filtering out any repeating values. I’d then like a count of these values. With this I can do some simple maths.

At this point am I better to use flux and possibly create a query that can nail it in one go? There are other dashboards relying on InfluxQL. Will switching the data source settings to flux break them?

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/b/8/b843d58a3f8ec41f66d3101d92cad9f8c28d37c7.png)

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [February 17, 2025, 1:35am UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/2 "2025-02-17T01:35:24Z")

</div>

Please provide sample data as inline csv  
for all data points

```auto
Col1,col2,date
Foo,33

```

then the final result wanted from all of these data points

---

<div class="post-metadata">

**Author:** ![grant2](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/grant2/32/42281_2.png) [@grant2](https://community.grafana.com/u/grant2)\
**Post date:** [February 17, 2025, 11:40am UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/3 "2025-02-17T11:40:02Z")

</div>

> [@cameron200sx](#):
>
> At this point am I better to use flux and possibly create a query that can nail it in one go?

Yes, but 1) Flux is not being actively developed by InfluxDB for about 2 years now (but is being actively supported and developed by [Fluxpipe](https://github.com/metrico/fluXpipe)) and 2) Flux has a steeper learning curve than InfluxQL (at least for some people).

> [@cameron200sx](#):
>
> There are other dashboards relying on InfluxQL. Will switching the data source settings to flux break them?

I am pretty sure you have to choose Flux, InfluxQL or SQL for each instance of InfluxDB that you set up in Grafana. So if you’d have to create two Influx databases (one for Flux and one for InfluxQL) and send the relevant data to each, etc. Not impossible, but might be more than you wished for.

---

<div class="post-metadata">

**Author:** ![cameron200sx](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@cameron200sx](https://community.grafana.com/u/cameron200sx)\
**Post date:** [February 17, 2025, 7:02pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/4 "2025-02-17T19:02:44Z")

</div>

Hopefully this works

Raw data something like - Note weight diff query included

| Time | weight.value { tagName: Net\_Weight\_Head\_1 } | weight.value { tagName: Net\_Weight\_Head\_10 } | weight.value { tagName: Net\_Weight\_Head\_11 } | weight.value { tagName: Net\_Weight\_Head\_12 } | weight.value { tagName: Net\_Weight\_Head\_2 } | weight.value { tagName: Net\_Weight\_Head\_3 } | weight.value { tagName: Net\_Weight\_Head\_4 } | weight.value { tagName: Net\_Weight\_Head\_5 } | weight.value { tagName: Net\_Weight\_Head\_6 } | weight.value { tagName: Net\_Weight\_Head\_7 } | weight.value { tagName: Net\_Weight\_Head\_8 } | weight.value { tagName: Net\_Weight\_Head\_9 } | weight.diff { tagName: Net\_Weight\_Head\_1 } | weight.diff { tagName: Net\_Weight\_Head\_10 } | weight.diff { tagName: Net\_Weight\_Head\_11 } | weight.diff { tagName: Net\_Weight\_Head\_12 } | weight.diff { tagName: Net\_Weight\_Head\_2 } | weight.diff { tagName: Net\_Weight\_Head\_3 } | weight.diff { tagName: Net\_Weight\_Head\_4 } | weight.diff { tagName: Net\_Weight\_Head\_5 } | weight.diff { tagName: Net\_Weight\_Head\_6 } | weight.diff { tagName: Net\_Weight\_Head\_7 } | weight.diff { tagName: Net\_Weight\_Head\_8 } | weight.diff { tagName: Net\_Weight\_Head\_9 } |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 18/02/2025 6:48 | 901 | 897 | 900 | 906 | 904 | 903 | 899 | 902 | 899 | 926 | 900 | 900 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 18/02/2025 6:48 | | | | | | | | | 898 | | | | | | | | | | | | -1.6 | | | |
| 18/02/2025 6:48 | | | | | | | | | | 920 | | | | | | | | | | | | -5.5 | | |
| 18/02/2025 6:48 | | | | | | | | | | | 902 | | | | | | | | | | | | 2.6 | |
| 18/02/2025 6:48 | | | | | | | | | | | | 900 | | | | | | | | | | | | 0.8 |
| 18/02/2025 6:48 | | 900 | | | | | | | | | | | | 2.9 | | | | | | | | | | |
| 18/02/2025 6:48 | 901 | 900 | 900 | 906 | 904 | 903 | 899 | 902 | 898 | 920 | 902 | 900 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 18/02/2025 6:48 | | | 909 | | | | | | | | | | | | 8.6 | | | | | | | | | |
| 18/02/2025 6:48 | | | | 909 | | | | | | | | | | | | 2.7 | | | | | | | | |
| 18/02/2025 6:48 | 906 | | | | | | | | | | | | 4.7 | | | | | | | | | | | |
| 18/02/2025 6:48 | | | | | 896 | | | | | | | | | | | | -8.3 | | | | | | | |
| 18/02/2025 6:48 | | | | | | 909 | | | | | | | | | | | | 5.4 | | | | | | |
| 18/02/2025 6:48 | 906 | 900 | 909 | 909 | 896 | 909 | 899 | 902 | 898 | 920 | 902 | 900 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 18/02/2025 6:48 | | | | | | | 905 | | | | | | | | | | | | 5.5 | | | | | |
| 18/02/2025 6:48 | | | | | | | | 902 | | | | | | | | | | | | 0.2 | | | | |
| 18/02/2025 6:48 | | | | | | | | | 893 | | | | | | | | | | | | -5.1 | | | |
| 18/02/2025 6:48 | | | | | | | | | | 911 | | | | | | | | | | | | -9.6 | | |
| 18/02/2025 6:48 | | | | | | | | | | | 900 | | | | | | | | | | | | -2.3 | |
| 18/02/2025 6:48 | | | | | | | | | | | | 903 | | | | | | | | | | | | 2.9 |
| 18/02/2025 6:48 | 906 | 900 | 909 | 909 | 896 | 909 | 905 | 902 | 893 | 911 | 900 | 903 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 18/02/2025 6:48 | | 900 | | | | | | | | | | | | 0.8 | | | | | | | | | | |
| 18/02/2025 6:48 | | | 900 | | | | | | | | | | | | -8.8 | | | | | | | | | |
| 18/02/2025 6:48 | | | | 911 | | | | | | | | | | | | 2.3 | | | | | | | | |
| 18/02/2025 6:48 | 903 | | | | | | | | | | | | -2.6 | | | | | | | | | | | |
| 18/02/2025 6:48 | | | | | 899 | | | | | | | | | | | | 2.6 | | | | | | | |
| 18/02/2025 6:48 | 903 | 900 | 900 | 911 | 899 | 909 | 905 | 902 | 893 | 911 | 900 | 903 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 18/02/2025 6:48 | | | | | | 904 | | | | | | | | | | | | -4.6 | | | | | | |
| 18/02/2025 6:48 | | | | | | | 909 | | | | | | | | | | | | 4.4 | | | | | |
| 18/02/2025 6:48 | | | | | | | | 901 | | | | | | | | | | | | -1.3 | | | | |
| 18/02/2025 6:48 | | | | | | | | | 898 | | | | | | | | | | | | 5.4 | | | |
| 18/02/2025 6:48 | | | | | | | | | | 913 | | | | | | | | | | | | 2.6 | | |
| 18/02/2025 6:48 | 903 | 900 | 900 | 911 | 899 | 904 | 909 | 901 | 898 | 913 | 900 | 903 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 18/02/2025 6:48 | | | | | | | | | | | 905 | | | | | | | | | | | | 5.3 | |
| 18/02/2025 6:48 | | | | | | | | | | | | 907 | | | | | | | | | | | | 3.2 |
| 18/02/2025 6:48 | | 900 | | | | | | | | | | | | -0.5 | | | | | | | | | | |
| 18/02/2025 6:48 | | | 903 | | | | | | | | | | | | 2.7 | | | | | | | | | |
| 18/02/2025 6:48 | | | | 906 | | | | | | | | | | | | -5.1 | | | | | | | | |
| 18/02/2025 6:48 | 900 | | | | | | | | | | | | -3 | | | | | | | | | | | |

After transformations something like

| Time | weight.value { tagName: Net\_Weight\_Head\_1 } | weight.value { tagName: Net\_Weight\_Head\_10 } | weight.value { tagName: Net\_Weight\_Head\_11 } | weight.value { tagName: Net\_Weight\_Head\_12 } | weight.value { tagName: Net\_Weight\_Head\_2 } | weight.value { tagName: Net\_Weight\_Head\_3 } | weight.value { tagName: Net\_Weight\_Head\_4 } | weight.value { tagName: Net\_Weight\_Head\_5 } | weight.value { tagName: Net\_Weight\_Head\_6 } | weight.value { tagName: Net\_Weight\_Head\_7 } | weight.value { tagName: Net\_Weight\_Head\_8 } | weight.value { tagName: Net\_Weight\_Head\_9 } |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 18/02/2025 6:48 | 901 | | | | | | | | | | | |
| 18/02/2025 6:48 | | | | | 904 | | | | | | | |
| 18/02/2025 6:48 | | | | | | 903 | | | | | | |
| 18/02/2025 6:48 | | | | | | | 899 | | | | | |
| 18/02/2025 6:48 | | | | | | | | 902 | | | | |
| 18/02/2025 6:48 | | | | | | | | | 898 | | | |
| 18/02/2025 6:48 | | | | | | | | | | 920 | | |
| 18/02/2025 6:48 | | | | | | | | | | | 902 | |
| 18/02/2025 6:48 | | | | | | | | | | | | 900 |
| 18/02/2025 6:48 | | 900 | | | | | | | | | | |
| 18/02/2025 6:48 | | | 909 | | | | | | | | | |
| 18/02/2025 6:48 | | | | 909 | | | | | | | | |
| 18/02/2025 6:48 | 906 | | | | | | | | | | | |
| 18/02/2025 6:48 | | | | | 896 | | | | | | | |
| 18/02/2025 6:48 | | | | | | 909 | | | | | | |
| 18/02/2025 6:48 | | | | | | | 905 | | | | | |
| 18/02/2025 6:48 | | | | | | | | 902 | | | | |
| 18/02/2025 6:48 | | | | | | | | | 893 | | | |
| 18/02/2025 6:48 | | | | | | | | | | 911 | | |
| 18/02/2025 6:48 | | | | | | | | | | | 900 | |
| 18/02/2025 6:48 | | | | | | | | | | | | 903 |
| 18/02/2025 6:48 | | 900 | | | | | | | | | | |
| 18/02/2025 6:48 | | | 900 | | | | | | | | | |
| 18/02/2025 6:48 | | | | 911 | | | | | | | | |
| 18/02/2025 6:48 | 903 | | | | | | | | | | | |
| 18/02/2025 6:48 | | | | | 899 | | | | | | | |
| 18/02/2025 6:48 | | | | | | 904 | | | | | | |
| 18/02/2025 6:48 | | | | | | | 909 | | | | | |
| 18/02/2025 6:48 | | | | | | | | 901 | | | | |
| 18/02/2025 6:48 | | | | | | | | | 898 | | | |
| 18/02/2025 6:48 | | | | | | | | | | 913 | | |
| 18/02/2025 6:48 | | | | | | | | | | | 905 | |
| 18/02/2025 6:48 | | | | | | | | | | | | 907 |
| 18/02/2025 6:48 | | 900 | | | | | | | | | | |
| 18/02/2025 6:48 | | | 903 | | | | | | | | | |
| 18/02/2025 6:48 | | | | 906 | | | | | | | | |
| 18/02/2025 6:48 | 900 | | | | | | | | | | | |

After the transforms to get only the changing weight I’d like to

- Add up all weights
- Count the amount of weights
- Multiply the number of weights by a set number to get a total
- Calculate total difference

---

<div class="post-metadata">

**Author:** ![cameron200sx](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@cameron200sx](https://community.grafana.com/u/cameron200sx)\
**Post date:** [February 17, 2025, 7:14pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/5 "2025-02-17T19:14:43Z")

</div>

Thank you. It may be an idea to set another instance up to try out Flux

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [February 17, 2025, 7:24pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/6 "2025-02-17T19:24:49Z")

</div>

that does not look like the raw data from your database, it looks pivoted

please post like the following the data exactly as it is in your influxdb

```auto
foo,bar,date,value
jedi,luke,2025-02-18 13:33:33,34.1

```

---

<div class="post-metadata">

**Author:** ![cameron200sx](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@cameron200sx](https://community.grafana.com/u/cameron200sx)\
**Post date:** [February 17, 2025, 10:33pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/7 "2025-02-17T22:33:53Z")

</div>

Sorry. Direct from InfluxDB

| \_start | \_stop | \_time | \_value | \_field | \_measurement | group | line | machine | site | tagName |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:09:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:10:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:11:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:12:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:13:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:14:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:15:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:16:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:17:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:18:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:19:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:20:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:21:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:22:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:23:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:24:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:25:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:26:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:27:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:28:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:29:00Z | 1.6000000000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 1.5999999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_12 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:30:00Z | 923.7999999999997 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:31:00Z | 923.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:32:00Z | 923.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:33:00Z | 923.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:34:00Z | 923.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:35:00Z | 923.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:36:00Z | 923.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:37:00Z | 923.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:38:00Z | 929.1590909090905 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:39:00Z | 882.5818181818181 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:40:00Z | 870.3999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:41:00Z | 870.3999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:42:00Z | 870.3999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:43:00Z | 879.8142857142855 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:44:00Z | 939.8608695652174 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:45:00Z | 942.5 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:46:00Z | 929.2454545454547 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:47:00Z | 890.5304347826087 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:48:00Z | 891.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:49:00Z | 896.2227272727268 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:50:00Z | 896.1166666666671 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:51:00Z | 887.2909090909092 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:52:00Z | 892 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:53:00Z | 896.1125000000003 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:54:00Z | 896.9652174 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:55:00Z | 896.7999999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:56:00Z | 895.8434782608699 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:57:00Z | 898.7919999999998 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:58:00Z | 898.1000000000001 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T16:59:00Z | 898.8272727272728 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:00:00Z | 893.3045454545453 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:01:00Z | 895.8759999999997 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:02:00Z | 903.1130434782611 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:03:00Z | 902.2000000000004 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:04:00Z | 903.0954545454547 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:05:00Z | 907.7260869565217 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:06:00Z | 903.4500000000002 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:07:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:08:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:09:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:10:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:11:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:12:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:13:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:14:00Z | 901 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:15:00Z | 906.7714285714288 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:16:00Z | 941.452381 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:17:00Z | 942.7142857142857 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:18:00Z | 938.6285714285711 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:19:00Z | 919.4428571428567 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:20:00Z | 917.8666666666668 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:21:00Z | 915.9909090909091 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:22:00Z | 917.8499999999997 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:23:00Z | 917.5363636363635 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:24:00Z | 921.2545454545453 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:25:00Z | 915.9576923076924 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:26:00Z | 915.4642857142859 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:27:00Z | 906.1896551724134 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:28:00Z | 906.1560000000002 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:29:00Z | 904.6259259259258 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:30:00Z | 905.1321428571428 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:31:00Z | 905.1724137931034 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:32:00Z | 902.1571428571428 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:33:00Z | 901.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:34:00Z | 901.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:35:00Z | 901.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:36:00Z | 901.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:37:00Z | 901.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:38:00Z | 901.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:39:00Z | 901.8999999999999 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:40:00Z | 901.7285714285711 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:41:00Z | 900.7500000000002 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:42:00Z | 902.8107142857142 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:43:00Z | 899.6285714285714 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:44:00Z | 898.2481481481481 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:45:00Z | 906.0862069 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:46:00Z | 903.3107142857143 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:47:00Z | 902.5862069 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:48:00Z | 904.4541666666664 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:49:00Z | 902.2319999999996 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:50:00Z | 904.1185185185183 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:51:00Z | 902.8482759 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:52:00Z | 909.2896552 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:53:00Z | 909.3034482758623 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:54:00Z | 903.9413793 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:55:00Z | 906.5035714285713 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:56:00Z | 901.9827586206898 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:57:00Z | 903.1714285714285 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |
| 2025-02-17T16:29:17.3176487Z | 2025-02-17T22:29:17.3176487Z | 2025-02-17T17:58:00Z | 901.0565217391301 | value | weight | Heads | Mtn | Filler | 56Aintree | Net\_Weight\_Head\_2 |

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [February 17, 2025, 10:39pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/8 "2025-02-17T22:39:30Z")

</div>

> [@cameron200sx](#):
>
> situation is that I have 2 queries and 5 transformations just to get the result I need from InfluxDB using InfluxQL. This result is only half the equation. What I then need is another set of queries and transformations to get another number and perform some maths with using the first number I described.

thanks for nice sample usable data set. are the 2 queries and 5 transformations and the other set of queries strictly on this sample set of data you provided?

---

<div class="post-metadata">

**Author:** ![cameron200sx](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@cameron200sx](https://community.grafana.com/u/cameron200sx)\
**Post date:** [February 17, 2025, 10:41pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/9 "2025-02-17T22:41:33Z")

</div>

Yes, correct

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [February 17, 2025, 11:04pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/10 "2025-02-17T23:04:53Z")

</div>

using the sample data you provided what will the final result(s) you want look like, please also provide this as csv, and what visualization would you like to use? bar chart, time series?

```auto
my,final,result
foo,34.4,2025

```

---

<div class="post-metadata">

**Author:** ![cameron200sx](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@cameron200sx](https://community.grafana.com/u/cameron200sx)\
**Post date:** [February 18, 2025, 7:59pm UTC](https://community.grafana.com/t/math-based-on-another-panel/144021/11 "2025-02-18T19:59:17Z")

</div>

Thanks for your reply 🙂  
I’m struggling to do this in an easy way in this form. In my eyes the data needs to be pivoted to have the tagName as a column. This allows one to get distinct values by comparing the previous. In un-pivoted form there is no point comparing the value to the previous as until it is filtered by tagName.

My thoughts on how I’d do it…

- Get distinct values per tagName for time period, add up
- Count values per tagName and add them together to get a total count of all tagName
- Multiply this count by the ideal weight - in this case 900
- Compare the total of all tagName and the total of ideal to get a difference

This would just appear as a number using the stat panel.

Would you like me to pivot it and do the calculations?
