MAX

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the maximum value of an expression across all input values.

Syntax 

1max(<expression>)

Arguments 

Required 

  • <expression>: An expression of any comparable type.

Returns 

Returns the same type as the argument. Returns NULL if no rows are selected.

Considerations 

  • NULL values are ignored in the calculation.
  • Works with numeric types, strings, dates, and other comparable types.
  • For strings, returns the lexicographically greatest value.

Examples 

Find Maximum Value 

Get the highest price.

1SELECT max(price) AS highest_price
2FROM products;

Maximum by Group 

Find the maximum value per group.

1SELECT category, max(price) AS max_price
2FROM products
3GROUP BY category;

Maximum Date 

Find the most recent date.

1SELECT max(order_date) AS latest_order
2FROM orders;

Related Documentation