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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

How to calculate average of measure

Hello,

 

I am trying to calculate average value by Quarter directly in Power BI model but when I compare the result to what I got in Excel performing the same calculatioon, I see different result. I simplified a table that I used and it looks like this:

 

QuarterPriceSF$/Sf
154545121245.00
132323212115.24
223232121219.17
234344212116.19
323232121219.17
42323332327.19
445454232319.57

 

My goal is to show average $/SF by Quarter in a clustered chart in Power BI. It is easy since I have ready $/SF calculated per each line in Excel.

 

But I tried to do this calculation directly in Power BI and I got different result. 

 

I used the table from above as data soirce in Power BI and this is how I calculated Avg S/SF:

 

$/SF Avg = AVERAGEX(Sheet1,DIVIDE(SUM(Sheet1[Price]),SUM(Sheet1[SF])))

This is a table that shows Avg $/SF value by Quarter (from Excel) compared to Avg $/SF by Quarter calculated in Power BI. Does anyone know why there is a difference?

 Avg  ExcelAvg Power BI
130.126.1
217.717.3
319.219.2
413.412.4

 

Thank you.

1 ACCEPTED SOLUTION
Sean
Community Champion
Community Champion

@lazzarjovvch74

Get rid of the 2 SUM functions inside the DIVIDE just reference the columns

 

AVERAGEX.png

View solution in original post

5 REPLIES 5
Sean
Community Champion
Community Champion

@lazzarjovvch74

Get rid of the 2 SUM functions inside the DIVIDE just reference the columns

 

AVERAGEX.png

jthomson
Solution Sage
Solution Sage

Looks like Power BI is adding up the prices and SF values before dividing them to get your average, whereas Excel is doing each line individually and then taking the average of each individual line's result

It seems like that. How could I do in Power BI what Excel does with Average function? That is my goal, to do that directly in Power BI.


@lazzarjovvch74 wrote:

It seems like that. How could I do in Power BI what Excel does with Average function? That is my goal, to do that directly in Power BI.


It's probably possible by making a calculated column that divides one by the other, sticking that column into a visual and using average as an option, if that's intended behaviour - by your method, if I've got two people selling pens and one person sells 99 red pens and no blue pens, and another sells no red pens but one blue pen, and I've got a calculation that has proportion of total pens sold that are red, Power Bi would give 99% whereas your method would give 50%...

Thank you all guys for the explanantion. I'm still growing in DAX.  It works now.

 

Best

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors