Grafana 7.5.1 with InfluxDB 1.8.2. I'm trying to create a table that displays a sum of the "units" values for each distinct tag value. I am getting the data, but I need the sums to be sorted in descending order by default. This is my Flux query:
from(bucket: "consumption")
|> range(start: -1y)
|> filter(fn: (r) => r._measurement == "stuff" and r._field == "units" and r._value > 0)
|> group(columns: ["dc","tnt"])
|> sum(column: "_value")
|> sort(columns: ["_value"], desc: true)
|> map(fn: (r) => ({r with _value: r._value / 4.0}))
|> yield()
I also have a Reduce transformation (Calculations --> Total) and Organize Fields transformation.
But no matter what I do in the sort function, it doesn't change anything in the table. The table is just always sorted alphabetically by the tag values ("dc", "tnt"). I need it to be sorted by _value descending. What am I doing wrong?
Thanks!