Forum Discussion
Problem with Row context
- 6 years ago
Good to hear. What I learned from this is that only the first expression of the Calculate() is impacted by the context transition. That was not clear to me before.
Did you know that you can pack variables inside the sumx ?
sumx(
var a=selectedvalue(b)
return caclulate()
)
etc.
No I did not know that, but even when I change it to using variable I get the same results.
- lbendlin6 years agoSuper User
You didn't show how you changed it. What I am trying to point out is that the moment you use CALCULATE(), SELECTEDVALUE takes on a new meaning, one that you might not intend.
https://www.sqlbi.com/articles/context-transition-and-filters-in-calculate/
- pcavacas6 years agoHelper I
This is the measure that I have
SUMX ('VF APF Rate',var planAccountId = SELECTEDVALUE ( 'VF APF Rate'[PlanAccountID] )var productCode = SELECTEDVALUE ( 'VF APF Rate'[Product Code] )var minDate = SELECTEDVALUE( 'VF APF Rate'[MinDate] )var maxDate = SELECTEDVALUE( 'VF APF Rate'[MaxDate] )Return'VF APF Rate'[Rate]* CALCULATE ([Latest Estimate Revenue],FILTER (ALL ( 'VF Demand Forecast' ),'VF Demand Forecast'[PlanAccountID] = planAccountId&& 'VF Demand Forecast'[PrdId] = productCode&& 'VF Demand Forecast'[Date] >= minDate&& 'VF Demand Forecast'[Date] <= maxDate)))- pcavacas6 years agoHelper I
I created a simple PBIX example that shows my problem located here
https://oceanspray-my.sharepoint.com/:u:/p/pcavacas/ESwZvaxMNz1Kq0EjUI9m8ocBnLrTIIq1fy4egxA8yoYrOA?e=04oTLe