Top() and limit() function won't work

Hello guys. I’ve been struggling with something.
I am using the table format in grafana and it won’t limit the results to just showing the “top 10”.
I’ve tried both the limit and top function, but basically nothing happens. I’ve been through the documentation and am hoping someone on this community could help me out.


bucketdata = from(bucket: “BUCKETNAME”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == “raw_data”)
|> filter(fn: (r) => r["_field"] ==“last_cpu_time”)
|> sort(columns: [“last_cpu_time”], desc: true)
|> limit(n:10)
|> yield()

This won’t even work with one field measurement, in the ideal scenario I’d like to use more measurements than just last_cpu_time and grouping them. But can’t seem to get it to work with just one already, let alone more fields.

@user1912 Looks like a simple query that should work. Could you please check if filters are returning records before piping to sort, limit, etc?