Aggregating Multiple Entities Into a Single Averaged Graph

Hi everyone,

I have the following current setup:

I’m trying to compare the outside temperature to the tire pressure in all 4 tires of my car. However, if I had 4 queries for my 4 car tires, there will be 4 lines for the pressure to compare to 1 temperature line. Is there a way I can “average” the value at each timestamp into a single data point, and thus a single line so I can compare 1 line to 1 line?

Thanks!

Hi @kackerlacka

There are a lot of ways you can aggregate and average 4 distinct series into one that calculates the average, but first, a question:

Could you not adjust your FL Tire query to include all four tires instead of just tire 3? Between the influx query language and Grafana’s transformations, this is possible, but the devil is in the details.

If you did have four distinct series for your four tires, then you could use an Outer Join transformation and then add field from calculation like I did here with some static data(let me know if link doesn’t work):

Then you could use organize fields to hide everything except the two time series that you want to compare:

Or, ideally, you perform a lot of these transformations and calculations on the DB side, inside influx, so that Grafana can query a prepared AVG-PSI-over-time series. That will always be more performant that doing this in browser, but the transformations are super powerful and useful :+1:

@mattabrams i am trying to use this transformation to calc average across multiple series, however many a times some points in those series are zero, could you please suggest how can we ignore the points with zero value before calculating average?

e.g. say i have three series namely A, B and C, and at time 1:00:00 A=10, B=30 and C=20, so the average calculated by this transformation is 20 which is correct. However if at 1:00:30, if A=10, B=0 and C=20, it shows (10+0+20)/3 = 10 where i expect the result to be (10+20)/2 = 15.