I'm new to FluxQL and was wondering if I can sum values regardless of tag value grouped by a timestamp.
I have something like this:
_time | _measurement | collection | _value |
---|---|---|---|
0001 | some_measurement | foo | 1 |
0001 | some_measurement | bar | 12 |
0002 | some_measurement | foo | 8 |
0002 | some_measurement | bar | 4 |
I want to sum values by time so in the end I would need something like:
_time | _measurement | collection | _value |
---|---|---|---|
0001 | some_measurement | total | 13 |
0002 | some_measurement | total | 12 |
Have in mind that I may have ~100 different collection tag values.
To sum values by time, you need to group them
|> group(columns: ["_time", "_measurement"])
You can add any column you want to keep.
The measurements will not always be sorted by time, so if you need that, just add:
|> sort(columns: ["_time"])