Not able to performmultiple operations on a single column

I am usi g influx DB v 2 , and getting below error could you please do the needful
data = () => from(bucket: “example bucket”)

|> range(start: v.timeRangeStart, stop: v.timeRangeStop)

|> filter(fn: (r) => r._measurement == “measurment” and r.ServiceName == " tag name ")

|> filter(fn: (r) => r._field == “field”)

|> filter(fn: (r) => r[“OrganizationCode”] =~ /^${OrganizationCode:regex}$/ )

|> group(columns: [“OrganizationCode”, “_measurement”], mode:“by”)

avg = data() |> mean() |> set(key: “_field”, value: “avg”)

count = data() |> count() set(key: “_field”, value: “count”)

pct = data() |> quantile(q: 0.95) set(key: “_field”, value: “95percentile”)

union(tables: [avg, count, pct])

|> pivot(rowKey: [“_start”], columnKey: [“_field”], valueColumn: “_value”)

Note: both servicename and OrganizationCode are tags

Below error :
error @8:27-8:61: missing required argument tables error @9:35-9:76: missing required argument tables

Hi @Sravs_Sekhar

What happens if you change these two lines to be like this?

count = data() |> count() |> set(key: “_field”, value: “count”)
pct = data() |> quantile(q: 0.95) |> set(key: “_field”, value: “95percentile”)