Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

RLS on working on Calculated Column

I found that Row Level Security does not work on calculated colum.  

The follwoing is my simple data model.

I have 3 measures defined on Price table:

Retail Low := CALCULATE(MIN(Price[Price]),PriceType[Price_Type_Name]="Retail")
Wholesale Low := CALCULATE(MIN(Price[Price]),PriceType[Price_Type_Name]="Wholesale")
PriceDiffMeasure := [Wholesale Low]-[Retail Low]
A calculated colum is defined on Terminal table:
Ternimal[DiffCalucatedCol] = Price[PriceDiffMeasure]
When no RLS is applied, the PriceDiffMeasure and Ternimal[DiffCalucatedCol] have same value, as I have expected. The following is a screenshot of table showing this:
I created a RLS rule applied to Price table. (Customer_ID=2). However, I see DiffCalucatedCol and PriceDiffMeasure have different values. Compared with table above, value of  DiffCalcuatedCol did not change after RLS is applied. 
The following is RLS rule setting. 
 
 
The following is the screenshot of Price table
 I have to use Caluclated Column in the terminal table since it will be eventually used as a legend of a Map and measure can't be used as legend on a map.  Does anyone know how to apply RLS to calculated column?
The related pbix file can be found here.

 

4 Replies


  • Anonymous wrote:
      Does anyone know how to apply RLS to calculated column?

     


    You can't do this, calculated columns are calculated once during data refresh over all the data in the model. RLS rules are applied dynamically at run time, so by the time the RLS kicks in the calculated column is already calculated.

     

    Do you need to have every distinct difference value in your legend? If not you could use a dynamic segmentation approach to group the different values eg https://www.daxpatterns.com/dynamic-segmentation/ into various ranges of differences.

    • Anonymous's avatar
      Anonymous
      Not applicable

      d_gosbell  thank you for the repsone.  I don't need to show every distince value.  The legend of map is categories of price diff range. I have not looked every line of dynamic segmentation, but it seems this methond can generate range measures.  However, my problem is that measure CAN'T be used a the legend of map. do you have any suggestions?