Max/Min with 3 or more values

Hi all,

Not sure if I’m missing something obvious, but I can’t seem to use MIN or MAX functions when comparing more than 2 values?

I can create a workaround in this case as I’m only comparing 10 values, but may need a better solution for future projects with more columns. Does anyone have any suggestions?


Hi Alistair,

for 3 or 4 values you can use nested MIN or MAX functions. For instance:

min(min([A], [B]), [C])

For more values, the idiomatic way would be to unpivot then aggregate:

range_min_max.morph (3.7 KB)

PS. In general, EasyMorph encourages moving complexity out of expressions into transformations, keeping expressions simple and readable.

Cheers Dmitry. Personally I find fewer transformations easier to read and understand if I need to re-visit it, so always work that way. At the moment I have 5 transformations doing the job of a MAX function, which I don’t particularly like (again, just a personal preference), but it works and will save me time in future!

Is there any chance of developing the MIN/MAX functions in the future to accommodate multiple values?

I see your point, Alistair. We will redesign and extend the expression syntax at some point to allow unlimited arguments in functions, the unary minus, optional parentheses, and reusable sub-expressions. But it’s not on the roadmap for the next year.

Sounds good, cheers Dmitry!