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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mmossy
New Member

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 by month per SKU.  The below tables are basic examples of my data and the 3rd table is a summary of how i want the calculations to work.  Basically i need a running total of forecasted SOH where the SKU SOH for any given month returns 0 if the forecasted SOH is less than 0, but i would like the negative amount to carry over as open sales orders.  So with SKU A, it returns 0 at 31/03/2025 because it is forecasted to be less than 0, but at 30/04/2025 it returns 7 because Opening Stock + Forecast Movements + Net units carried over = 0 + 10 - 3 = 7

 

DateSKUStock on Hand
28/02/2025A2
28/02/2025B8

 

MonthYrSKUNet Forecast Movements
31/03/2025A-5
30/04/2025A10
31/03/2025B1
30/04/2025B5

 

DateSKUOpening SOHNet Forecast MovementsForecasted SOH
31/03/2025A2-50
31/03/2025B819
30/04/2025A0107
30/04/2025B9514

 

 

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

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

View solution in original post

4 REPLIES 4
v-ssriganesh
Community Support
Community Support

Hi @mmossy,

May I ask if you have resolved this issue? If so, please mark it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-ssriganesh
Community Support
Community Support

Hi @mmossy,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

v-ssriganesh
Community Support
Community Support

Hi @mmossy,

Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @johnt75 for sharing valuable insights.

 

Could you please confirm if your query has been resolved by the provided solution? If so, please mark it as the solution. This will help other community members solve similar problems faster.

Thank you.

johnt75
Super User
Super User

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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