Forum Discussion

Sergii24's avatar
Sergii24
Icon for Super User rankSuper User
5 years ago
Solved

Issue with evaluation context/context transition

Dear all,   I've got lost a bit in all types of filters and transitions of Power BI and would appretiate a lot your help! In my dataset I have columns for Stock and Orders in items that should be ...
  • Fowmy's avatar
    5 years ago

    Sergii24 

    Not clear about the model and the relationship. Try an approach like below

     

    Match (Stock) =
    
    SUMX(
        VALUES(Stock[Items]) 
        VAR _NetStock = [Stock Qty] - [Open Orders]
        VAR _Result =
        IF(
            _NetStock >= 0,
            [Open Orders],
            [Stock Qty]
        )
        RETURN _Result
    )