This doesn’t give me the sum, but a all entries in the table money from 1 day ago until now. Including all columns, not only “EUR”. What am I doing wrong ?
> select * from test;
name: test
time tag1 tag2 val1 val2
---- ---- ---- ---- ----
1559739619893678416 a b 10 20
1559746780130967615 c d 100 200
1559747185291002660 a b 1 2
1559747196858276080 a d 1000 2000
> select sum(val1) from test;
name: test
time sum
---- ---
0 1111
Flux seems to by default group by all unique tag combinations. It’s summing all values where tag1 and tag2 are the same. If they are not the same, they get summed separately.
Connected to http://localhost4:8086 version 1.7.6
InfluxDB shell version: 1.7.6
Enter a Flux query
> from(bucket: "test")
|> range(start: -1y)
|> filter(fn: (r) => r._measurement == "test" and r._field == "val1")
> from(bucket: "test")
|> range(start: -1y)
|> filter(fn: (r) => r._measurement == "test" and r._field == "val1")
|> sum()
Result: _result
Table: keys: [_start, _stop, _field, _measurement, tag1, tag2]
_start:time _stop:time _field:string _measurement:string tag1:string tag2:string _value:float
------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ---------------------- ----------------------------
2018-06-06T15:07:49.611260047Z 2019-06-05T15:07:49.611260047Z val1 test a b 11
Table: keys: [_start, _stop, _field, _measurement, tag1, tag2]
_start:time _stop:time _field:string _measurement:string tag1:string tag2:string _value:float
------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ---------------------- ----------------------------
2018-06-06T15:07:49.611260047Z 2019-06-05T15:07:49.611260047Z val1 test a d 1000
Table: keys: [_start, _stop, _field, _measurement, tag1, tag2]
_start:time _stop:time _field:string _measurement:string tag1:string tag2:string _value:float
------------------------------ ------------------------------ ---------------------- ---------------------- ---------------------- ---------------------- ----------------------------
2018-06-06T15:07:49.611260047Z 2019-06-05T15:07:49.611260047Z val1 test c d 100
>
How can I make flux to not group by all unique tag combinations ?