I’m an InfluxDB2 and Flux newbie, I’m learning how to use flux and wondered if someone can help with a problem. I have a query that groups records by a tag and then I want to order those grouped results. I’m using the sort() function, but no matter where I put it in the query it will not sort on the tag. The query is:
from(bucket: "default")
|> range (start: -1d)
|> filter(fn: (r) => r["_measurement"] == "batch_results")
|> filter(fn: (r) => r["_field"] == "batch_start")
|> group(columns: ["batch"])
|> last()
|> sort(columns: ["batch"], desc: true)
The query results are in ascending order of the “batch” tag, but I need them in descending order. Do I need a different function for this?