Calculates the average (arithmetic mean) of a set of expressions evaluated over a table.
Quick Coach Video |
What it does? Calculates the average (arithmetic mean) of a set of expressions evaluated over a table. Syntax AVERAGEX(<table>, <expression>) Returns A decimal number |
What is the AVERAGEX Function?
The AVERAGEX function in DAX is like the thoughtful friend who takes the time to assess each individual situation before making a decision! It calculates the average of an expression evaluated over a table, which means it’s perfect for when you need to analyze data row by row and then find that average.
Try It
Check out our DAX class.
Example 1: Café Sales Analysis
Imagine you own a café, and you want to find the average price of the drinks sold, factoring in different sizes and prices. Here’s how your sales data might look:
Drink |
Size |
Price |
Espresso |
Small |
2.50 |
Latte |
Medium |
4.00 |
Cappuccino |
Large |
5.00 |
Americano |
Small |
3.00 |
To find the average price of the drinks sold, you’d use the AVERAGEX function like this:
Average Drink Price= AVERAGEX(Sales, Sales[Price])
So, what’s the average price? Adding them up gives you 2.50 + 4.00 + 5.00 + 3.00 = 14.50. Dividing by 4 drinks gives you an average price of $3.63. That’s a great deal for a delightful drink!
Example 2: Fitness Tracker
Now, let’s say you’re tracking your workout sessions, and you want to find the average calories burned over several workouts. Here’s your data:
Workout |
Calories Burned |
Calories Burned Cooldown |
Running |
300 |
50 |
Cycling |
450 |
75 |
Yoga |
200 |
60 |
Strength Training |
300 |
20 |
Synchronized Swimming |
850 |
100 |
To find the average calories burned per workout, you’d use the function like this:
Average Calories Burned =
AVERAGEX(Workouts,Workouts[Calories Burned Workout]
+ Workouts [Calories Burned Cooldown])
Calculating the total calories burned for each workout, you have:
- Running: 300 + 50 = 350
- Cycling: 450 + 75 = 525
- Yoga: 200 + 60 = 260
- Strength Training = 300 +20 = 320
- Synchronized Swimming: 850 + 100 = 950
Adding these totals gives you 350 + 525 + 260 + 320 + 950 = 2405. Dividing by 5 workouts gives you an average of 481 calories burned per session! Keep up the great work! Notice how we can iterate the appropriate addition for each row.
Conclusion: Evaluate and Average!
The AVERAGEX function is your go-to tool for calculating averages based on evaluated expressions, whether it’s drink prices, total calories burned, or any other row-based analysis. With just a simple function, you can gain deeper insights from your data.
So, what are you waiting for? Get averaging with AVERAGEX and make your data tell a more complete story!