MINX DAX Function in Power BI

The MINX DAX function takes as its first argument a table, or an expression that returns a table. The second argument contains the expression that is evaluated for each row of the table. It returns the smallest value.

DAX Syntax MINX(table, expression)

The function has the following parameters:
• table: The table containing the rows for which the expression will be evaluated.
• expression: The expression to be evaluated for each row of the table.

Example: The following is the table used in the calculation.

MINX dax function in Power BI

DAX

MINX Measure = MINX(Ashishdata, Ashishdata[Teachersalary]- Ashishdata[Expenditure])

The output of the above measure is shown below:

MINX dax function in Power BI

The following points demonstrates how the function works:
• Ashishdata[Teachersalary] - Ashishdata[Expenditure]: The expression calculates the difference between Teachersalary and Expenditure value for each row.
• The function after that returns the minimum value of that expression.

The MINX function respects the filter context, as shown in the image below.

MINX dax function in Power BI

We can also use the FILTER function to specify the table as an argument.

DAX

MINX Measure = MINX(FILTER(Ashishdata, Ashishdata[State]= "Punjab"), Ashishdata[Teachersalary]- Ashishdata[Expenditure])

Here, by using FILTER we have filtered the rows where State column value is Punjab. So we can see the MINX value from the Punjab state only.

MINX dax function in Power BI

As we know, FILTER function respects the current filter context, so when we apply the filter on the state column by using the slicer, we get Blank in the result, as shown in the image below:

MINX dax function in Power BI