MaxIf

The MaxIf function finds the maximum value for a column or group if the conditions are true.

📘

The MaxIf function is an aggregate function.

Aggregate functions evaluate one or more rows of data and return a single value.

In a table element, the aggregate is calculated for each grouping. For information on how to add a grouping with an aggregate calculation to a table, see Group columns in a table.

In a table with no groupings, the aggregate is calculated for each row. For information on how to calculate summary statistics across all rows in a table, see Add summary statistics to a table.

To learn more about using aggregate functions, see Building complex formulas with grouped data.

Syntax

MaxIf(field, condition)

Function arguments:

  • field (required) - The column to search.
  • condition (required) - The condition to test. For each row, if the condition is True, it is included in the aggregate calculation.

Notes

  • The field argument must be a value with the Number, Date, or Text data type.

Examples

MaxIf([Distance], [Departure Delay] > 0)
  • In a table summary, returns the greatest Distance from among all rows in the table where Departure Delay is greater than 0.
  • In a calculated column in an ungrouped table, returns each row's own Distance value. If Departure Delay is not greater than 0, returns Null.
  • In a table grouped by Airline, returns the greatest Distance for each airline from among all rows in the grouping where Departure Delay is greater than 0.
MaxIf([Invoice Date], [State] = "TX")
  • Finds the greatest Invoice Date for all entries where the State indicated is Texas.
MaxIf([Sales], [Region] = "East" AND [Status] = "Complete")
  • Finds the maximum Sale value for entries in the "East" Region that are marked as "Complete".