<!-- https://learnsql.cpetoday.com/functions/dax/min -->
# MIN

Language: DAX
Category: Aggregation
Syntax: MIN(<column>) or MIN(<expression1>, <expression2>)
Summary: Returns the smallest value in a column, or the smaller of two values.
Returns: A value of the same type as the input (a scalar). BLANK when the column has no values in the current filter context.
Level: Beginner
Related: MINX, MAX, SUM, FIRSTDATE, LASTDATE, COALESCE

## What it does
MIN finds the lowest value in one column that is still visible after the filters are applied. It also has a second form that compares two values side by side and returns the smaller one, which is useful for capping a figure. Use it for the lowest price paid, the earliest posting date or the smallest invoice in a period.

## Syntax and arguments
- column: a column reference such as `Sales[SalesAmount]`. Blank values are ignored.
- expression1, expression2 (second form): two single values, such as a column in a calculated column and a fixed number. The smaller one is returned.

## Example
The procurement lead wants the lowest unit cost paid for each product this year, to see where prices have dropped.

```dax
Lowest Unit Cost = MIN(Product[UnitCost])
```

With the year slicer set, the measure looks only at products visible in that year. Placed on a matrix with product names on the rows, each product shows its own minimum.

## Example: a second, different use
Cap a line's recognized amount at an approved limit, using a calculated column:

```dax
Capped Amount = MIN(Sales[SalesAmount], 5000)
```

Each line shows its own sales amount unless it exceeds 5,000, in which case it shows 5,000. This is a row level calculation, so it belongs in a calculated column, not a measure.

## Things to watch
- MIN on a column ignores blanks. If the column is empty in the current context, the result is BLANK.
- The two argument form works on single values, not on whole columns. For a calculation per row over a table, use MINX.
- MIN on a date column gives the earliest date. Combine it with `CALCULATE` when you need the first date of a customer or account.
- The result has the data type of the column. A text column returns text, which is rarely what you want for a minimum.
- MIN ignores the order of rows, so a "first" or "last" value needs a date to sort by.

## In business terms
MIN is used for the earliest invoice date in an aging report, the lowest margin in a product group, the lowest bid received, and any cap or floor applied to a balance, such as a credit limit or a minimum fee.
