Forum Discussion

LanceTDL's avatar
LanceTDL
Frequent Visitor
5 years ago
Solved

Running Total based on a Seperate Value

Hello All,  I am a new user to Power BI, I am familiar with SQL, but still learning DAX. I am struggling to find any answers on the issue I am having. I have transactional data in SQL that I have ...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, LanceTDL 

    Please check the below picture and the sample pbix file's link down below.

     

     

    Running Qty On Hand Measure =
    VAR transactioncumulatereverse =
    CALCULATE (
    SUM ( Transactions[Transactional Qty] ),
    FILTER ( ALL ( Dates ), Dates[Date] >= MAX ( Dates[Date] ) )
    )
    RETURN
    IF (
    ISFILTERED ( Dates[Date] ),
    IF (
    NOT ISBLANK ( SUM ( Transactions[Transactional Qty] ) ),
    transactioncumulatereverse
    + SUMX ( Transactions, RELATED ( Items[Qty on Hand] ) )
    )
    )

     

     

    https://www.dropbox.com/s/cne3sh5r1mz30ip/lance.pbix?dl=0 

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM