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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
yaya1974
Helper III
Helper III

weighted average price in powerbi with multiple filters

I am trying to calculate my weighted avg price based on 4 different columns. 

I need the filters by Year, PL Market, Model, and Finish

I've tried all sorts of formulas, all ending up with errors.  This is my last one, but not filtered on anything.

Weight = DIVIDE(SUMX(Costs,Costs[OEM/OES Price]*Costs[Shipped]),SUMX(Costs,Costs[OEM/OES Price]))

 

Here is example in excel with outcome I am looking for in yellow:

Screenshot 2024-07-03 150122.png

Can anyone help, please?

Thank you! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@yaya1974  I am glad to help you.

If you want to get the most basic calculations. I.e. the final result that you have marked in excel with a yellow background, you can refer to my test result below
Note that I have used ALL() in the measure which will remove all the filters, so if you want the filter (slicer) restrictions to be calculated inside the measure you may need to use the ALLSELECTED() or ALLEXCEPT() functions to suit your real calculation environment.
Of course, if you just want to get the results you want to show in excel, you can refer to my measures and calculate column below.

Here is the DAX code I create.

Calculate column:

 

Ext. Price = 'product'[Units]*[7.1.23 Price]

 

 

vjtianmsft_0-1720057142011.png

vjtianmsft_1-1720057150234.png

Measure:

 

M_Ext_PriceSum = CALCULATE(SUM('product'[Ext. Price]),FILTER(ALL('product'),'product'[PL Market]=MAX('product'[PL Market])))
M_MarketNum = CALCULATE(SUM('product'[Units]),FILTER(ALL('product'),'product'[PL Market]=MAX('product'[PL Market])))
M_result = DIVIDE([M_Ext_PriceSum],[M_MarketNum],0) 

 

Here is my test data:

vjtianmsft_2-1720057221733.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
yaya1974
Helper III
Helper III

Thanks so much!!   IT worked perfectly.  I did use the Allexcept function though, as I had more columns to filter out.

Thanks again!

Anonymous
Not applicable

Hi,@yaya1974 .
You are welcome.

Anonymous
Not applicable

Hi,@yaya1974  I am glad to help you.

If you want to get the most basic calculations. I.e. the final result that you have marked in excel with a yellow background, you can refer to my test result below
Note that I have used ALL() in the measure which will remove all the filters, so if you want the filter (slicer) restrictions to be calculated inside the measure you may need to use the ALLSELECTED() or ALLEXCEPT() functions to suit your real calculation environment.
Of course, if you just want to get the results you want to show in excel, you can refer to my measures and calculate column below.

Here is the DAX code I create.

Calculate column:

 

Ext. Price = 'product'[Units]*[7.1.23 Price]

 

 

vjtianmsft_0-1720057142011.png

vjtianmsft_1-1720057150234.png

Measure:

 

M_Ext_PriceSum = CALCULATE(SUM('product'[Ext. Price]),FILTER(ALL('product'),'product'[PL Market]=MAX('product'[PL Market])))
M_MarketNum = CALCULATE(SUM('product'[Units]),FILTER(ALL('product'),'product'[PL Market]=MAX('product'[PL Market])))
M_result = DIVIDE([M_Ext_PriceSum],[M_MarketNum],0) 

 

Here is my test data:

vjtianmsft_2-1720057221733.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.

Best Regards,

Carson Jian,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.