Forum Discussion
RLS Rules
This might be a stupid question but it caused a bit of confusion in my team.
Some DAX functions have remarks that state:
This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
Does this relate that the function can't be used (will not work properly) if there is RLS applied or does it stated that it can't be used when setting up RLS conditions?
So basically I can't use:
= SUMX(FILTER(InternetSales, InternetSales[SalesTerritoryID]=5),[Freight])
when setting up RLS logic, but I can use it normally in the dashboards
- Anonymous4 years ago
Hi Krcmajster ,
I have built a data sample for better understanding:
ID is 5 = SUMX(FILTER(InternetSales, InternetSales[SalesTerritoryID]=5),[Freight])User is E = SUMX(FILTER(InternetSales, InternetSales[User]="E"),[Freight])RLS is used to restrict data access for given users. The DAX filter expression used for RLS should return a True/False value, so I created two roles:
The final output is shown below:
So based on my test, Import +SUMX() could works for RLS.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- amitchandakSuper User
Krcmajster ,You can create this like a measure.
= SUMX(FILTER(InternetSales, InternetSales[SalesTerritoryID]=5),[Freight])
There are a few limitations for what you can use in new column in Direct Query
- KrcmajsterHelper IV
amitchandak Thanks for your answer. Direct Query is of no interset for me. My question is more about RLS. We have multiple clients in our database and we apply RLS based on client name in one table
Now, I want to use functions like SUMX or CROSSFilter in my measures (I am not setting up RLS) but I am unsure if they will be impaceted by RLS.
- AnonymousNot applicable
Hi Krcmajster ,
I have built a data sample for better understanding:
ID is 5 = SUMX(FILTER(InternetSales, InternetSales[SalesTerritoryID]=5),[Freight])User is E = SUMX(FILTER(InternetSales, InternetSales[User]="E"),[Freight])RLS is used to restrict data access for given users. The DAX filter expression used for RLS should return a True/False value, so I created two roles:
The final output is shown below:
So based on my test, Import +SUMX() could works for RLS.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - Ashish_MathurSuper User
Hi,
Is this any better?
=calculate([freight],InternetSales[SalesTerritoryID]=5)