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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
ifenek
Frequent Visitor

Projected stock calculation help

Hello, 

 

I need help, I'm trying to implement a stock projection calculation in place. 

What I'm looking to do is to say if I have enough stock to despatch a product. For that i'm looking at previous orders for the same product. If the due date of the despatch is the same the idea is to look at the earliest activationdate to determine an order. 

I have a column showing the available stock for the particular product. This value should be decreasing in regards of the previous orders and not stay the same like it is right now. 

 

I've attached a sample file as well as an excel spreadsheet with the calculation I'd like to achieve 

 

https://we.tl/t-g9aFPxZqwt

 

ifenek_0-1633001149224.png

 

1 REPLY 1
MFelix
Super User
Super User

Hi @ifenek ,

 

Trythe follwoing code:

 

Result =
SUM ( Example[availableforassembly] )
    - IF (
        SELECTEDVALUE ( Example[duedate] )
            <= MAXX (
                FILTER ( ALL ( Example ), Example[duedate] < MAX ( Example[duedate] ) ),
                Example[duedate]
            ),
        SUM ( Example[remaingquantity] ),
        CALCULATE (
            SUM ( Example[remaingquantity] ),
            FILTER ( ALL ( Example ), Example[duedate] < MAX ( Example[duedate] ) )
        )
    )

 

Be aware that this may need some changes, because I'm not sure if I understood your requirements especially on getting the previous value.

MFelix_0-1633350024415.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Users online (2,254)