/    /  Amazon QuickSight – maxIf

Amazon QuickSight – maxIf

 

The ‘maxIf’ function in Amazon QuickSight is used to compute the maximum value of a measure, subject to a condition or set of conditions. Here is an explanation of the maxIf() function:

Syntax

#Start#
maxIf(measure, condition)
#End#

 

This function takes two arguments:

 

  • measure: This parameter specifies the measure for which the maximum value is to be computed.
  • condition: This parameter specifies one or more conditions that the data must satisfy in order to be included in the maximum calculation.

 

Suppose we have a dataset that contains information about sales transactions and we want to find the maximum sales amount for the East region. We can use the maxIf() function in Amazon QuickSight to do this.

 

To find the maximum sales amount for the East region, we can create a new calculated field in Amazon QuickSight with the following expression:

Example

#Start#
maxIf(SalesAmount, Region = 'East')
#End#

 

This expression will compute the maximum sales amount for transactions that occurred in the East region.

 

For instance, if our sales transaction data is as follows:

 

Transaction IDRegionSales Amount
1East$1000
2West$500
3East$2000
4South$1200
5West$3000
6South$900

 

Then, the maximum sales amount for the East region will be:

Example

#Start#
maxIf(SalesAmount, Region = 'East') = $2000
#End#

 

In this example, we can see that the maxIf() function has computed the maximum sales amount for the East region, resulting in a useful metric that can inform our business decisions.