Forum Discussion
pcavacas
6 years agoHelper I
Problem with Row context
I have a report that has a bunch of columns on it and have a weird behavior that I cannot figure out what is going on. One of the formulas, the APF colum, is blank for all rows that are not at the l...
- 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.
lbendlin
6 years agoSuper User
I don't think this is row context. Row context applies to the raw data tables and is generally accessed via calculated columns.
Try using variables
APF =
var v1 = SELECTEDVALUE ( 'VF APF Rate'[PlanAccountID] )
var v2 = SELECTEDVALUE ( 'VF APF Rate'[Product Code] )
var v3 = SELECTEDVALUE( 'VF APF Rate'[MinDate] )
var v4 = SELECTEDVALUE( 'VF APF Rate'[MaxDate] )
var v1 = SELECTEDVALUE ( 'VF APF Rate'[PlanAccountID] )
var v2 = SELECTEDVALUE ( 'VF APF Rate'[Product Code] )
var v3 = SELECTEDVALUE( 'VF APF Rate'[MinDate] )
var v4 = SELECTEDVALUE( 'VF APF Rate'[MaxDate] )
return COUNTROWS(FILTER (
ALL ( 'VF Demand Forecast' ),
'VF Demand Forecast'[PlanAccountID] = v1
&& 'VF Demand Forecast'[PrdId] = v2
&& 'VF Demand Forecast'[Date] >= v3
&& 'VF Demand Forecast'[Date] <= v4
)
That way you preserve the important parts of the filter context before you destroy it with ALL().
pcavacas
6 years agoHelper I
The problem with what you are saying here, is that the actual calculation is a SumX over the APF Rates table, so I can't grab the values into variables.