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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cparker4486
Helper III
Helper III

Finding Average Unit Price Across Invoices

Very new to Measures and struggling to wrap my head around this. It's probably going to be quite simple once I see the answer.

 

InvoiceProductQuantiyUnit Price
INV001Apple3$5.00
INV002Apple2$4.50
INV003Apple7$7.22

 

You can see that the Apple is not always sold for the same Unit Price. I want to answer the following question, "What is average unit price for the Apple?"

 

The answer is (5 + 4.5 + 7.22)/3 = 5.57.

 

My data table layout is quite different but I made a measure that uses DISCOUNTCOUNT() to count the number of invoices in my fact table and I then used that in another measure in my dimensions table.

 

Avg. Unit Price = SUMX('Invoice Lines (2) Dim', SUM([Unit Price]) / [Distinct Order Count])
 
This gives me a wildly high number so I'm obviously not thinking about this the right way.
1 ACCEPTED SOLUTION
Shahid12523
Community Champion
Community Champion

Avg Unit Price Per Invoice =
AVERAGEX(
VALUES('Invoice Lines (2) Dim'[Invoice]),
CALCULATE(AVERAGE('Invoice Lines (2) Dim'[Unit Price]))
)


This gives you the average unit price per invoice, not weighted by quantity—just like your example. Clean, accurate, and context-aware.

 

Shahed Shaikh

View solution in original post

6 REPLIES 6
v-hashadapu
Community Support
Community Support

Hi @cparker4486 , Thank you for reaching out to the Microsoft Fabric Community Forum.

 

I reproduced the scenario on my end using sample data and it worked successfully. To help you better understand the implementation, I’ve attached the .pbix file for your reference. Please take a look at it and let me know your observations.

 

Thank you for being part of the Microsoft Fabric Community!

Shahid12523
Community Champion
Community Champion

Avg Unit Price Per Invoice =
AVERAGEX(
VALUES('Invoice Lines (2) Dim'[Invoice]),
CALCULATE(AVERAGE('Invoice Lines (2) Dim'[Unit Price]))
)


This gives you the average unit price per invoice, not weighted by quantity—just like your example. Clean, accurate, and context-aware.

 

Shahed Shaikh
Ashish_Mathur
Super User
Super User

Hi,

Wouldn't you want to calculate the weighted average price instead?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

That would also be good to know. Please provide the formula if you can. Thank you.

Try this measure

Avg. Unit Price = SUMX('Invoice Lines (2) Dim', 'Invoice Lines (2) Dim'[Unit Price]*'Invoice Lines (2) Dim'[Quantity]) /sum('Invoice Lines (2) Dim'[Quantity])

  


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@cparker4486 

you can try this 

Average Unit Price = AVERAGE('Sales'[Unit Price])

 

If this does not work, pls provide the whole sample data. It's becuase it looks like you have more than one table. 

 

pls provide the sample data and expected output.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.