Forum Discussion

mmossy's avatar
mmossy
Regular Visitor
1 year ago
Solved

Forecasted Inventory while staying above zero if negative

I currently have an issue with trying to forecast my stock on hand by SKU by month.  I have my current SOH by SKU as well as forecasted sales & purchases which i have summarised into a net movements ...
  • johnt75's avatar
    1 year ago

    Try

    Forecasted SOH =
    VAR CurrentDate =
        MAX ( 'Date'[Date] )
    VAR Result =
        SUMX (
            'Product',
            VAR ForecastValue =
                CALCULATE (
                    SUM ( Forecast[Net forecast movements] ),
                    'Date'[Date] <= CurrentDate
                )
            VAR Total = 'Product'[Stock on hand] + ForecastValue
            VAR Result =
                MAX ( Total, 0 )
            RETURN
                Result
        )
    RETURN
        Result