Forum Discussion
Sergii24
Super User
5 years agoIssue 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
Super User
5 years agoSergii24
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
)
Sergii24
Super User
5 years agoFowmy , thank you very much! It looks like that outer SUMX is what was missing!
In my understanding once I wrote 2 separate measures for "Stock Qty" and "Open Orders" I was ready to use them together in a new, 3rd measure, having already a row context, which is wrong.
The correct way, instead, is to have another outer SUMX even in my third variable ("Match Stock") that is introducing row context for this new measure for the first time!
Thanks a lot for filling this gap in my knowledge! 🙂