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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vipett
Helper II
Helper II

Calculate projected stock

I've tried a lot of examples from previous posts about this topic, both from this site and other sites but still cant get it to work,

See below for a non-working solution and how my data is structured:

 

This is my table "To output"

vipett_0-1698394602503.png

Where the inventory balance is the current forecast, Fct is the forecasted consumption, Demand date is the first date of each month Rolling 12, Stock use just puts the inventory balance to the first demand date and 0 on the other dates, OpenPO is incoming purchase orders. Qty is just the sum of Stock Use-Fct+OpenPO.

 

This is the current output:

vipett_1-1698395078126.png

As you can see, it is not cumulating the figures as it should.

Stock projection in November should be 241, December 239,etc 

 

Expected stock change = (SUM( ToOutput[Fct] )*-1)+SUM(ToOutput[OpenPO])
Stock Level = Max(ToOutput[Stock Use])
 
Stock projection =
VAR ExpectedChange =
    CALCULATE(
        [Expected stock change],
        FILTER(
            ALL( 'Calendar Demand' ) ,
               'Calendar Demand'[Date] <=  MAX( 'Calendar Demand'[Date] )
        )
    )
VAR StockLevel =
    CALCULATE(
        [Stock level] ,
        FILTER(
            ALL( 'Calendar Demand' ) ,
                'Calendar Demand'[Date] <=  MAX( 'Calendar Demand'[Date] )
        )
    )
RETURN
    ExpectedChange + StockLevel

 

What am I doing wrong here?

1 ACCEPTED SOLUTION
vipett
Helper II
Helper II

Was apparently as easy as using a quick measure..
 
Qty running total in Demand date =
CALCULATE(
    SUM('ToOutput'[Qty]),
    FILTER(
        ALLSELECTED('ToOutput'[Demand date]),
        ISONORAFTER('ToOutput'[Demand date], MAX('ToOutput'[Demand date]), DESC)
    )
)

View solution in original post

1 REPLY 1
vipett
Helper II
Helper II

Was apparently as easy as using a quick measure..
 
Qty running total in Demand date =
CALCULATE(
    SUM('ToOutput'[Qty]),
    FILTER(
        ALLSELECTED('ToOutput'[Demand date]),
        ISONORAFTER('ToOutput'[Demand date], MAX('ToOutput'[Demand date]), DESC)
    )
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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