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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
zenisekd
Super User
Super User

Calculation of Product cost for Sale order line from BOM with nearest purchased price of products

Hi, 

I am having a trouble with solving following scenario.
I am trying to come up with calculation of Product cost for Sale order line table (I would like to calculate a margin from it). However, it is above my capabilities. 

 

  • The products that we sell are simple products (with a single line of BOM) and composite (with multiple BOM lines).
  • One product can be sold as simple product or as a part of the composite. 
  • The cost of the product (when sale is done) is supposed to be created as the cost of purchased product from Purchase order line with the nearest date of the product purchase (to the sales). In other words, we sell product A on Firday, the cost of it is taken from the nearest purchase, e.g. Thursday.
  • In order to get the cost of the composite, I have to look into BOM, collect the nearest costs from purchase  (based on sell date) and sum them. And here lies the problem. 
    The model look like this at the moment: 
    zenisekd_0-1618396685689.png

     


    I am trying to figure out, how to get the cost as a new column to the Sale order line table ... or perhaps to calculate it as a measure. Any ideas?

    The model above is not completed, I am just showing the key components for the calculation...

1 REPLY 1
lbendlin
Super User
Super User

Try to redraw your data model.  As I understand it you have a Composites -> Products -> BOM lines  dimension hierarchy and then you have purchase order and sales order facts ?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.