Grouping Multiple Measurements - Help Please

Hey everyone.
I’ve got a problem I am trying to solve for a while now.
I have the following data:

Tags: use_case, language
Fields: iterations

Measurement 1: use_case - UC_1, language - English, iterations - 10
Measurement 2: use_case - UC_2, language - English, iterations - 5
Measurement 3: use_case - UC_1, language - French, iterations - 15
Measurement 4: use_case - UC_2, language - French, iterations - 3

I want to create a table with the following output:

use_case | iterations_English | iterations_French
UC1 | 10 | 15
UC2 | 5 | 3

I know I can create a table with four lines if I group by both language and use_case, but that’s not what I desire.

I am not sure if it’s possible to do so, so I’d appreciate getting help, or let me know if it’s even possible in the first place.
I’m not even sure how to define it in a few words, so I apologize if I posted in the wrong place, or gave a misleading name.

I found some answers online, but they don’t seem to work for me, probably because the InfluxDB we are using is outdated. I’d like to see if there’s a solution before I try to request an upgrade.

Thank you very much!

Hello @At_AC,
Thanks for your question! Looks like you want to perform some joins with flux. What version of influxdb are you using? You’ll have to use at least 1.7.6 to enable flux. I recommend taking a look at this example in the spec and this blog for examples on how to perform a join in influx :slight_smile:

It’ll end up looking something like

join1 = join(tables: {t1: table1,  t2: table2}, on: ["_time", "_field"])
join2 = join(tables: {t3: table1,  t4: table2}, on: ["_time", "_field"])
join_final = join(tables: {j1: join1,  j2: join2}, on: ["_time", "_field"])

*multi-stream joins are coming soon IMPL#83

Thank you very much!
I have seen that answer before, so that probably means I can’t do it without having influxdb upgraded.
Since I am not the only one using it, I wanted to avoid it if I can.

In that case, I’ll just have to go for it.

Thank you, once more!