Amazon QuickSight – max
The ‘max’ function in Amazon QuickSight is used to compute the maximum value of a measure, optionally grouped by one or more dimensions.
Syntax
#Start# max(measure, [group-by level]) #End#
This function takes two arguments:
measure: This parameter specifies the measure for which the maximum value is to be computed.
group-by level (optional): This parameter specifies one or more dimensions to group the maximum calculation by.
Suppose we have a dataset that contains information about sales transactions and we want to find the maximum sales amount by region. We can use the max() function in Amazon QuickSight to do this.
To find the maximum sales amount by region, we can create a new visual in Amazon QuickSight and add a table with the following settings:
Drag the “Region” dimension to the Rows section.
Drag the “Sales Amount” measure to the Values section.
Click on the drop-down arrow next to “Sales Amount” and select “Max”.
This will result in a table that shows the maximum sales amount by region.
Alternatively, we can create a calculated field in Amazon QuickSight with the following expression:
Example
#Start# max(SalesAmount, [Region]) #End#
This expression will compute the maximum sales amount by region.
For instance, if our sales transaction data is as follows:
| Transaction ID | Region | Sales Amount |
| 1 | East | $1000 |
| 2 | West | $500 |
| 3 | East | $2000 |
| 4 | South | $1200 |
| 5 | West | $3000 |
| 6 | South | $900 |
Then, the maximum sales amount by region will be:
Example
#Start# max(SalesAmount, [Region]) = {'East': $2000, 'West': $3000, 'South': $1200} #End#
In this example, we can see that the max() function has computed the maximum sales amount by region, resulting in a useful metric that can inform our business decisions.