Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
HassanAshas
Helper V
Helper V

What is the difference between subtracting Averages of two values and using the AVERAGEX Function

I am calculating the Average Profit Margin for a dataset of Films that I have. 

 

There are two measures which I believe should give same results, but they are not. 

 

First Measure is as follows, 

 

 

Average Profit Margin = DIVIDE([Average Box Office (m)] - [Average Budget (m)], [Average Box Office (m)], BLANK())

 

 
where the two measures are defined as follows, 
 

 

Average Box Office (m) = AVERAGE(Films[BoxOfficeDollars]) / 1000000

Average Budget (m) = AVERAGE(Films[BudgetDollars]) / 1000000

 

 

The second Measure is as follows,

 

Average Profit Margin AverageX = AVERAGEX(Films, DIVIDE(Films[BoxOfficeDollars] - Films[BudgetDollars], Films[BoxOfficeDollars], BLANK()))

 

 

Now, they are being used in the same Filter Context (as far as I understand), but their results are far different from each other. Following is the result that I am getting, 

 HassanAshas_0-1668062060589.png

 

I fail to understand why they are giving different results. Can anybody help me out in understanding this? 

If you would like to take a look at the dataset or the Workbook, you can download the complete Workbook from here: 

https://drive.google.com/file/d/1NFBEiRtzs7BrOFGyNESPmcWrf49yD8C7/view?usp=sharing

2 REPLIES 2
amitchandak
Super User
Super User

@HassanAshas , Averagex will do line level calculation the correct way for this

 

 DIVIDE(Sum(Films[BoxOfficeDollars]) - Sum(Films[BudgetDollars]), Sum(Films[BoxOfficeDollars]))

 

refer

https://radacad.com/sum-vs-sumx-what-is-the-difference-of-the-two-dax-functions-in-power-bi

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I understand the difference and I read the article as well, I still don't get it though. 

 

I understand that AVERAGEX will first calculate the difference row-by-row and then take the average of all the differences calculated. 

 

Whereas in Average function, you already have all the Averaged values and then you are taking the Difference of those. But that shouldn't cause any problem, should it? Because the filter context is still the same for both the scenarios. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.