Get maximum of sum in calculated column not possible?

Today I wanted to get the maximum value of a column (which by itself is a sum) which would then be used in a custom column:

The error message is: expecting expression but found function sum returning aggregation .
So this does not seem to work. I found this: Fix custom expression being to aggresive in an aggregation by ariya · Pull Request #21834 · metabase/metabase · GitHub which deals with about the same error message, but the floor() function instead of max().

The custom column also fails if I try to create it in a separate step below the current section.

Is it supposed to be like that, or is this a similar problem as I found on github?

Best Greetings

So if you do a new step and try using the max in that new step it will fail?

yes, exactly, and it displays exactly the same error message.
But now, in the meantime, I found out that the max() function may not be what I would need for the use case.
The function would need to get the maximum value of all rows in a column, and then put this value in a new column.

The data is like

   step:  pieces: duration:    
process1      123       124
process2       20       120
process3      100        55

And I would need to get the number 123 and put it into a new column in all rows for further calculation...

I am not sure if there is a way to do this at all with the Metabase gui. Maybe it would be better to do it in SQL - but then the users cannot click through to get to the individual records... :upside_down_face:

You could do it in SQL using a Window function, I'm sure. One to do when you're fresh at the start of the day :smiley:

1 Like