Forum Discussion

Reddyp's avatar
Reddyp
Helper I
4 years ago
Solved

Inventory aging report

I need to do this inventory calculation for individual branch (Example: if stock sold in branch 1 then the count of sold should deduct from Branch 1) Example: I have received stock to B ranch 1 on 1...
  • tamerj1's avatar
    4 years ago

    Hi Reddyp 
    Here is a sample file https://we.tl/t-fIVAYRKzHD
    One way is as follows: New Column >

    Result = 
    VAR NewStock = 
        SUMX ( 
            FILTER ( 
                CALCULATETABLE ( Stock, ALLEXCEPT ( Stock, Stock[Branch] ) ),
                Stock[Date] <= EARLIER ( Stock[Date] )
            ),
            Stock[New Stock]
        )
    VAR StockOut =
        CALCULATE ( SUM ( Stock[Stock out] ), ALLEXCEPT ( Stock, Stock[Branch] ) )
    VAR Difference = NewStock - StockOut
    RETURN
        IF (
            NOT ISBLANK ( Stock[New Stock] ),
            IF ( 
                Difference <= 0, 
                0, 
                IF ( NewStock - Stock[New Stock] > StockOut, Stock[New Stock], Difference )
            )
        )