Forum Discussion

JR_Lee's avatar
JR_Lee
Frequent Visitor
4 years ago
Solved

Calculating cumulative stock value

StockValue = CALCULATE( SUM ('Ledger Entry'[Quantity] * 'Ledger Entry'[Current Value] ) FILTER (ALL(Date), Date[Date] <= MAX('Date'[Date]))) Hi,   I have a data s...
  • smpa01's avatar
    smpa01
    4 years ago

    JR_Lee  and if you don't want to create dimension tables

     

    cumulativeQuantity =
    CALCULATE (
        SUM ( t2[Quantity] ),
        FILTER ( ALL ( t2 ), t2[Posting Date] <= MAX ( t2[Posting Date] ) )
    )
    
    
    _Cumulative Stock Value = 
    CALCULATE (
        SUMX ( t1, t1[Standard Cost] * related(t2[Quantity]) ),
        FILTER ( ALL ( t2), t2[Posting Date] <= MAX ( t2[Posting Date] ) )
    )