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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
eburke133
New Member

Average weighted part pricing

Is there a function(s) in Power BI that would calculate an average weighted pricing change over time? Weighted by the amount of spend in 2015.  I would also need this weighting to adjust based on the filters applied.  An example of a line item is below. 

Each line item represents an invoice.
There can be multiple suppliers for each part #.
The baseline for each part needs to be the earliest invoice date of that part. The furthest back the data goes is 1/1/13.
I would like to be able to pull up a chart and see and average weighted pricing change for each supplier.

 

Any insight/suggestions would be greatly appreciated.

Supplier     Year      Invoice Spend     Invoice Price       Part #      Time Period

ABC            2015        $650                      $6.50              Z867         1/1/13

3 REPLIES 3
MattAllington
Community Champion
Community Champion

I would think something like this should work.

 

=SUMX (
    VALUES ( Data[Part #] ),
    (CALCULATE ( MAX ( Data[Invoice Price] )LASTDATE ( Data[Time Period] ) )
            CALCULATE ( MIN ( Data[Invoice Price] )FIRSTDATE ( Data[Time Period] ) )
    )  CALCULATE ( SUM ( Data[Invoice Spend] ) )
)
 
SUM ( Data[Invoice Spend] )
 
Ideally you would have a product table and a calendar table and swap out the VALUES and the FIRST/LASTDATE portions with columns from those tables.

 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Thanks for the help here.  I am still having issues getting this to apply correctly.  Can you elaborate on the two tables?

Yeah, sorry that wasn't quite right.  It is always better/easier if you create a sample workbook and post it.  That will get the fastest and most accurate results.  

 

Total Spend:=sumx(values(Data[Part #]),calculate(SUMX ( Data,Data[Invoice Spend])))
Total Qty:=sumx(values(Data[Part #]),calculate(SUMX (
         Data,
        DIVIDE ( Data[Invoice Spend], Data[Invoice Price] )
    )))

 

Weighted Price:=DIVIDE([Total Spend] , [Total Qty])

 

 

Take a look at my Excel book here.

https://www.dropbox.com/s/vg1ztg9vr8542sh/weighted%20price.xlsx?dl=0 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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