DAX Tutorial: MAX, MAXX, and MAXA in Power BI.

Introduction

In this tutorial, we will explore three important functions in DAX: MAX, MAXX, and MAXA. These functions are used to find the maximum value in a column or a table, and they can be extremely useful in various data analysis scenarios.

MAX Function

The MAX function in DAX is used to find the maximum value in a column. It takes a column as its argument and returns the maximum value in that column. The syntax for the MAX function is as follows:

MAX(column)

For example, let’s say we have a table called “Sales” with a column called “Revenue”. To find the maximum revenue in the “Sales” table, we can use the following DAX formula:

MAX(Sales[Revenue])

This will return the maximum value in the “Revenue” column of the “Sales” table.

MAXX Function

The MAXX function in DAX is used to find the maximum value in a table after applying a calculation or expression to each row. It takes a table and an expression as its arguments. The syntax for the MAXX function is as follows:

MAXX(table, expression)

For example, let’s say we have a table called “Products” with columns “Product Name” and “Price”. To find the maximum price of the products in the “Products” table, we can use the following DAX formula:

MAXX(Products, Products[Price])

This will apply the expression “Products[Price]” to each row in the “Products” table and return the maximum value.

MAXA Function

The MAXA function in DAX is similar to the MAX function, but it can handle a wider range of data types. It takes a column as its argument and returns the maximum value in that column, regardless of the data type. The syntax for the MAXA function is as follows:

MAXA(column)

For example, let’s say we have a table called “Employees” with a column called “Salary”. To find the maximum salary in the “Employees” table, we can use the following DAX formula:

MAXA(Employees[Salary])

This will return the maximum value in the “Salary” column of the “Employees” table, regardless of whether the values are numeric or non-numeric.

Examples

Let’s look at some examples to better understand how these functions work:

Example 1:

MAX(Sales[Revenue])

This formula will return the maximum revenue in the “Sales” table.

Example 2:

MAXX(Products, Products[Price])

This formula will return the maximum price of the products in the “Products” table.

Example 3:

MAXA(Employees[Salary])

This formula will return the maximum salary in the “Employees” table.

Conclusion

The MAX, MAXX, and MAXA functions in Power BI DAX are powerful tools for finding the maximum value in a column or a table. By using these functions, you can easily analyze and visualize your data to gain valuable insights. Whether you need to find the maximum revenue, price, or salary, these functions will help you accomplish your data analysis goals in Power BI.

Remember to experiment and explore other DAX functions to further enhance your data analysis capabilities in Power BI.

Leave a Comment