cancel
Showing results for 
Search instead for 
Did you mean: 

Using a measure to filter a table on another measure does not work unless assigned to a variable

I think I have found a bug.
I have a slicer that will filter a table by a region's code. I have made it so that it will default to the current user's regional membership using RLS, with this measure

 

Region selected = SELECTEDVALUE('Region'[Code], 'RLS-filtered-table'[Code]).

 

I then have another measure, which uses this measure to get another column of that row

 

Selected group = 
var selectedRegion = [Region selected]
RETURN CALCULATE(MIN('region'[group]), FILTER('region', 'region'[Code] = selectedRegion))

 

Without the variable, this measure does not work. Eg. :

 

Selected group = 
RETURN CALCULATE(MIN('region'[group]), FILTER('region', 'region'[Code] = [Region selected]))

 

Is this expected behaviour? 

Status: New
Comments
v-chuncz-msft
Community Support

@LeoCie 

 

Every measure has an implicit CALCULATE that you can’t see, so measures always trigger context transition from within a row context.

https://www.sqlbi.com/articles/understanding-context-transition/