Forum Discussion
AnAnalyst
Helper III
3 years agoInventory Tracking and Order Fulfillment
I'm stuggling with creating a data model and calculations that answer the following questions: 1. What Orders Numbers will I not be able to fulfill in the future due to lack of stock. (Current Sto...
grantsamborn
Solution Sage
3 years agoHi AnAnalyst
Your measure [Sum of Ending Stock] in your model doesn't seem to work.
Would something like this help?
zBalance =
VAR _CurrentStock =
CALCULATE(
SUM( 'Current Stock'[Current Stock] ),
FILTER(
ALL( 'Date' ),
'Date'[Date] <= MAX( 'Date'[Date] )
)
)
VAR _CustomerOrders =
CALCULATE(
SUM( 'Customer Orders'[Order Quantity] ),
FILTER(
ALL( 'Date' ),
'Date'[Date] <= MAX( 'Date'[Date] )
)
) * -1
VAR _SupplierOrders =
CALCULATE(
SUM( 'Supplier Orders'[Quantity] ),
FILTER(
ALL( 'Date' ),
'Date'[Date] <= MAX( 'Date'[Date] )
)
)
VAR _Total = _CurrentStock + _CustomerOrders + _SupplierOrders
RETURN
_Total
Let me know if this helps or if you have any questions.
Added:
Regarding you questons...
1. Any time [zBalance] is less than 0 would indicate a lack of stock.
2. I'm not sure of your company's procedures/rules but I think that might take a little more work.
Sorry I had to add this. After re-reading I realized that you had other requiements besides the running balance.
grantsamborn
Solution Sage
3 years agoThe above measure will show a line for every date.
You would also probably want a measure like this so that can filter your table.
_Display = IF( ISBLANK( [Sum of Current Stock] + [Sum of Customer Orders] + [Sum of Supplier Orders] ), 0, 1 )