Custom expression on bar plot vs scatter plot

I am trying create a bar plot showing the average of sums over a categorical column.

The expression I have written works for a scatter plot, but not for a bar plot:

Avg(Sum([Concentration]) OVER ([id_sample_name])) OVER ([Axis.X])

When applied to a scatter plot, this generates one point for each value of the categorical X axis. However, when applied to a bar plot, it says "expression not valid". I guess I can see how for a bar plot it might need one additional level of aggregation in case "id_sample_name" is not completely nested within a single "Axis.X" category, however, I still can't get it to work.

Any answers would be much appreciated.



(1) Answer