from(bucket: “Grafana_Bucket”)

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

|> filter(fn: (r) => r._measurement == “MAY_4_New _Regen_Switch_logic_V24_fixed_portable”)

|> filter(fn: (r) =>r[“_field”] == “Vehicle_Speed”)

|> map(fn: (r) => ({

r with

category: if r._field == “BCM_ModeCommand” then

if r._value == 0 then “Category A”

else if r._value == 1 then “Category B”

else if r._value == 2 then “Category C”

else “Other Category”

else “”

}))

|> group(columns: [“category”])

|> max(column: “Vehicle_Speed”)

**error:"No column exist “Vehicle_Speed”. please tell how to resolve it.**

**i need to group the maximum of the vehicle_speed by each category.and represent it by Bar Graph.Please help me to get resolve this**

Hello @nagashree,

Can you please include a `|>yield(name: "after group")`

to see what the output is like before you try to take the max value?

I’d actually suggest using yield() statements like print statements so you can make sure that the result of each transformation is as you expect.

It looks like with your map() function you remove the vehicle_speed from your fields. And you’re changing it to Category A, B, C and Other.

Also you’ve filtered for only one field, Vihicle_Speed

so when you perform your map the first if statement is `._field == “BCM_ModeCommand”`

is not true so you’re not really doing anything.

you’d have to filter for both fields originally.

**strong text**from(bucket: “Grafana_Bucket”)

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

|> filter(fn: (r) => r._measurement == “19042023_V24_City_1R_ECO_sathish_battery_switch_test”)

|> filter(fn: (r) => r[“_field”] == “Vehicle_Speed”)

|> filter(fn: (r) => r[“_field”] == “BCM_ModeCommand”)

|> map(fn: (r) => ({

r with

category: if r._field == “BCM_ModeCommand” then

if r._value == 0 then “Category A”

else if r._value == 1 then “Category B”

else if r._value == 2 then “Category C”

else “Other Category”

else “”

}))

|> group(columns: [“category”])

|> max(column: “Vehicle_Speed”)

|> yield(name: “max_speed”)

As you suggested i am adding yield column and one more filter field even though i am not able to getting below error**. ot implemented: Error converting Predicate 'Some(Predicate { root: Some(Node { node_type: LogicalExpression, children: [Node { node_type: LogicalExpression, children: [Node { node_type: ComparisonExpression, children: [Node { node_type: TagRef, children: , value: Some(TagRefValue([0])) }, Node { node_type: Literal, children: , value: Some(StringValue(“19042023_V24_City_1R_ECO_sathish_battery_switch_test”)) }], value: Some(Comparison(Equal)) }, Node { node_type: ComparisonExpression, children: [Node { node_type: TagRef, children: , value: Some(TagRefValue([255])) }, Node { node_type: Literal, children: , value: Some(StringValue(“Vehicle_Speed”)) }], value: Some(Comparison(Equal)) }], value: Some(Logical(And)) }, Node { node_type: ComparisonExpression, children: [Node { node_type: TagRef, children: , value: Some(TagRefValue([255])) }, Node { node_type: Literal, children: , value: Some(StringValue(“BCM_ModeCommand”)) }], value: Some(Comparison(Equal)) }], value: Some(Logical(And)) }) }): Field columns not supported: Complex/Multi field predicates are not yet supported."