MINX

How to Use the Power BI DAX function MINX

In this article, we will discuss everything you need to know about the MINX function in Power BI, its syntax and usage, and some examples to illustrate its application.

Syntax of MINX Function

The syntax of the MINX function in Power BI is as follows:


MINX(table, expression)


Where:

- **table** is a reference to a table or a table expression that contains the values to be evaluated by the expression.

- **expression** is a scalar expression to be evaluated for each row of the table.

Usage of MINX Function

The MINX function in Power BI evaluates a specified expression over a table and returns the minimum value. The expression can be a column name, a formula, or a combination of both. The MINX function iterates through the rows of a table and evaluates the expression for each row, returning the minimum value at the end of the iteration.

The MINX function is commonly used in scenarios where a user wants to find the minimum value of a specific column or a set of columns based on certain criteria. For example, a user may want to find the minimum sales value for each region and display the results in a table or a chart.

Examples of MINX Function

Let's take a look at some examples to understand the usage of the MINX function in Power BI.

Example 1: Finding the Minimum Value of a Column

Suppose we have a table named Sales with the following data:

| Product | Sales |

|---------|-------|

| A | 100 |

| B | 200 |

| C | 150 |

| D | 300 |

To find the minimum value of the Sales column, we can use the MINX function as follows:


Minimum Sales = MINX(Sales, Sales[Sales])


Here, we have passed the Sales table as the first argument and the Sales[Sales] column as the second argument. The MINX function evaluates the Sales[Sales] column for each row of the Sales table and returns the minimum value, which is 100.

Example 2: Finding the Minimum Value of a Column Based on a Condition

Suppose we have a table named Sales with the following data:

| Product | Region | Sales |

|---------|--------|-------|

| A | North | 100 |

| B | North | 200 |

| C | South | 150 |

| D | South | 300 |

To find the minimum sales value for each region, we can use the MINX function as follows:


Minimum Sales by Region =

MINX(

FILTER(Sales, Sales[Region] = “North”),

Sales[Sales]

)


Here, we have used the FILTER function to filter the Sales table by the Region column, where the Region is North. The MINX function evaluates the Sales[Sales] column for each row of the filtered table and returns the minimum value, which is 100 for the North region.

Similarly, we can find the minimum sales value for the South region by changing the filter condition to "South".

The MINX function in Power BI is a powerful tool that allows users to find the minimum value of a specified expression evaluated over a table. By following the syntax and usage guidelines discussed in this article, users can leverage this function to create complex calculations and expressions in their reports and dashboards.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)