0

I have a measurement for the populations of different cities. I can get the last record one by one for each city but I would like to do that in one query. I don't know how to get that done because this is basically my first flux query. I tried the follow query. You can probably see that it gave me the last data point of either New York or Los Angeles instead of one for New York and one for Los Angeles.

from(bucket: "population")
  |> range(start: -7d)
  |> filter(fn: (r) => r["city"] == "New York") or r["city"] == "Los Angeles"]
  |> last()
Unplug
  • 709
  • 10
  • 27

1 Answers1

0

I would bet you would get result with two tables, one for each city, and each with one row, if there are data in both series in last 7 days period. I assume the above is a complete query (albeit with syntax errors) and city is a tag.

from(bucket: "population")
  |> range(start: -7d)
  |> filter(fn: (r) => r["city"] == "New York" or r["city"] == "Los Angeles")
  |> last()
alespour
  • 397
  • 1
  • 5