Function ‘MAX’ should have 1 argument(s) instead of 2 argument(s)

Hi Team,

I’m using the below simple max function in a calculated field, but getting the subjected error.

max({sales},[{merchant}])

image

The documentation indicates we can use group-by level as a second argument in MAX function

I want to achieve summarizing sales by merchant, then displaying the maximum and minimum sales under each category without showing specific merchant names.

Hey @zmaiymh ,

I assume you try to create a calculated max field on dataset level, LAC functions doesn’t work on that level.
Try the LAC function in the analysis and if this doesn’t show your desired outcome we can try to work it out.

BR
Robert

Thank you for your answer and let me know the difference!

In addition, as I describe in the question, I want to achieve this effect:
① {sales} is aggregated according to {merchant}
② Displays the maximum value of {sales} aggregated according to {merchant} under each {category}, and does not display {merchant} information in dimension

Does quicksight support this kind of calculation?
:grinning:

Hi @zmaiymh,

You can do this by using LAC-A functions.

avg(sum(sales, [merchant]))
max(sum(sales, [merchant]))
min(sum(sales, [merchant]))

The inner aggregation calculates the sum of sales grouped by merchant. The outer aggregation then calculates the average, max or min grouped by the dimension in your visual (category).