AVERAGEX

How to Use the Power BI DAX function AVERAGEX

What is the AVERAGEX Function?

The AVERAGEX function returns the average of an expression evaluated for each row in a table. It is an iterating function that goes through each row in a table and evaluates the expression provided. The expression can be any valid DAX expression that returns a scalar value, such as a measure or a column. The AVERAGEX function then calculates the average of all these values.

Syntax of the AVERAGEX Function

The syntax for the AVERAGEX function is straightforward. It takes two arguments:


AVERAGEX(table, expression)


– `table`: The table for which you want to calculate the average.

– `expression`: The expression you want to evaluate for each row in the table.

Using the AVERAGEX Function in Power BI

To use the AVERAGEX function in Power BI, follow these steps:

1. Open Power BI and create a new report.

2. Import the data you want to analyze.

3. Create a table or use an existing one.

4. Click on the table to select it.

5. Click on the “New Measure” button in the “Modeling” tab.

6. In the formula bar, enter the AVERAGEX function with the appropriate arguments.

7. Press enter to create the measure.

Example of Using the AVERAGEX Function

Suppose you have a table called “Sales” with columns “Region,” “Product,” and “SalesAmount.” You want to calculate the average sales amount for each region. Here’s how you can use the AVERAGEX function to achieve this:

1. Select the “Sales” table.

2. Click on the “New Measure” button in the “Modeling” tab.

3. In the formula bar, enter the following expression:


RegionAvgSales = AVERAGEX(Sales, Sales[SalesAmount])


4. Press enter to create the measure.

5. Now, you can use this measure in your visualizations to display the average sales amount for each region.

The AVERAGEX function is a powerful tool for data analysis in Power BI. It allows you to calculate the average of an expression evaluated for each row in a table. By following the steps outlined in this article, you can easily use this function to analyze your data and gain valuable insights.

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)