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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.