Arjen
1
Hi, today I tried switching from mongo timeseries to influx 2.2
I am trying to get count and quantile in one query
Would something like this be possible? Or do I need to write my own map/reducer code?
This works, pretty happy with this
from(bucket: "itsjustatest")
|> range(start: -10d)
|> group(columns: ["somegroup"])
|> quantile(q: 0.75)
but I need this ā¦ (which obviously does not work)
from(bucket: "itsjustatest")
|> range(start: -10d)
|> group(columns: ["somegroup"])
|> quantile(q: 0.75) as quantile and count() as count
Is there a way to do this using the native quantile and count ?
Hello @Arjen,
Absolutely! Welcome to Flux. It takes a second to get used to it especially if you come from InfluxQL or SQL.
Iād love to recommend the following resources:
You can do the following:
data = from(bucket: "itsjustatest")
|> range(start: -10d)
|> group(columns: ["somegroup"])
data |> quantile(q: 0.75)
|> yield(name: "quantile")
data |> quantile(q: 0.75)
|> yield(name: "count")
Arjen
3
Anaisdg thank you for this answer! I do like how this is done
1 Like
Arjen
4
I have tried it, works great. However doing this will give me 2 tables/rows. Using join I will get 3 rows
Is there any way just to have the data like
{quantile:123,count:123,field:'somevalue'}
{quantile:456,count:456,field:'anothervalue'}