Replace Tag by another Tag from second Query

Hello there,
I’d like to create a new Dashboard and could need some help in setting it up.

  • What Grafana version and what operating system are you using? Grafana v9.4.9

  • What are you trying to achieve?
    I have to different datatables, where I’d like to show the name (tag) from one table with a field from the second table.
    So I’d like to join these two tables into one, where the tags from both datatables are written into one.

Datatable one has a field battery with tag id:

timestamp id battery
09/01 11:00 1 3.74
09/01 11:05 2 2.34
09/01 12:00 1 3.72
09/01 12:05 2 2.31
09/01 13:00 1 3.71
09/01 13:05 2 2.27

The id from table one shows up in the second table as external id.
The timestamps are different for both datatables

timestamp name external_id latitude longitude
09/01 11:02 Device A 1 12.xx 13.xx
09/01 11:07 Device B 2 12.xx 13.xx
09/01 12:02 Device A 1 12.xx 13.xx
09/01 13:07 Device B 2 12.xx 13.xx

I’d like to set up a gauge to monitor the last battery level for both devices, but with the names Device A and B and not with the IDs 1 and 2

Expected result would be:

id battery
Device A 3.71
Device B 2.27

But I don’t know how I can get the connection between both datatables.
They are connectec by the tags “id” (table 1) and “external_id” (table 2)

  • How are you trying to achieve it?
    I don’t know how to do this join or how to get the replacement. Setting up the gauge with only datatable 1 wouldn’t be a problem at all

A hint which function could solve this, would help me a lot.

Thank you very much

Are you using Flux or InfluxQL?