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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
StevenCollins
Frequent Visitor

Forecasted Closing Stock Position

Hi,

Im struggling to create DAX measure for a forecasted closing stock position using the start point of the latest stock position, deducting forecasted sales, adding existing open purchase orders and adding forecasted purchase orders to create a forward stock position for each week going forward.

The below Excel example should help to explain:

StevenCollins_1-1687178960105.png

 

 

1 ACCEPTED SOLUTION
StevenCollins
Frequent Visitor
2 REPLIES 2
marcosvin
Resolver II
Resolver II

Hello!

 

Adding here some metrics to calculate last stock position value that might be helpful. The [Last Constant Stock] metric can be used in the metric that will do the additions and subtractions with the other forecast metrics.

 

Sum of Stock Qty = SUM(Table[Stock Qty])

Last Stock = CALCULATE(SUM(Table[Stock Qty]),LASTNONBLANK(Table[Date],[Sum of Stock Qty]))
Last Constant Stock = CALCULATE([Last Stock],ALL(Table[Date]),MAX(Table[Date])>=Table[Date])
 

This blog explains the use of the DAX LASTNONBLANK command very well:

DAX LASTDATE vs. LASTNONBLANK | Mitchellsql (mitchellpearson.com)

StevenCollins
Frequent Visitor

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.