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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ktp_99
Frequent Visitor

Calc weighted Average and value of remaining items

Need help with creating measures that calculates total value (total_cost) of remaining item and average unit cost (avg_cost).  These measures are for last remaining qty, so it should be based on latest date (working from latest to old). for below example, takes dec 25 units first, then dec 15, and last remaining from nov 20. 

 

DateQtyPrice     
10-May-18100750.25     
10-Apr-1850800.65     
20-Jul-181000780.25     
5-Aug-18500900.55     
9-Sep-18400760.95     
10-Oct-18200876.25     
25-Oct-18400800.65 Qty Left1800  
6-Nov-18600780.25     
10-Nov-18200900.55 qtypriceTotal Avg
20-Nov-18500760.95 100760.9576095.00 
15-Dec-18700876.25 700876.25613375.00 
25-Dec-181000800.65 1000800.65800650.00 
      1490120.00827.84
        
    measure_avg_cost 827.84 
    measure_total_cost 1490120.00 

 

 

Table contains 3 columns:

     Date -- date units added to inventory

     Qty -- qty added to inventory

     Price -- price for 1 unit

 

     qty_remaining -- calculated measure - current remaining qty 

 

want to create following calculated measures:

     avg_cost -- remaining qty avgerage unit cost

     total_cost -- remaining qty total cost

 

Thank You

16 REPLIES 16

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.