Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

ignore RLS for a aggregated measure

HI 

 

I HAVE A PBIX FILE I CAN SEND TO YOU IF YOU WANT A TEMPLATE 

 

I have a aggreate  sum measure that dosent work as entented after i apply RLS

Sales amount= sum(sales)

 

before RLS is applied

1) the company is chossen in "Company"

2) the employee is chossen in the table "Employee". In this case Frederik. 

3) an employee has different "sales" in different companies. see in the “sales by company”

4) the “sales by company” has no interaction to the company visual (made in format -> edit interaction)

MathiesJ_0-1648125500228.png

After RLS is applied
Now we have a problem in the “sales by company” when I have chosen Frederik in “sales by employee”

MathiesJ_1-1648125514526.png

When I chose an employee the sales amount only show the value for one company even tough that Frederik has sales in other companies.

 

the data model

MathiesJ_2-1648125536131.png

 

The RLS applied

SEARCH(","&LEFT(USERPRINCIPALNAME(),(FIND("@",USERPRINCIPALNAME(),1)-1))&",", [User] , 1, 0) > 0

the problem:

i cant add "TEST" to multiple companies in the user because TEST can only view for specific company in the report EXCEPT the “sales by company” then they need to see all the companies that an emplyee has sales.

The goal:

Get the same output as in the first picture AFTER i apply RLS and i chose an employee i have to see all sales for each company.

 

possible solutions:

writa a measure that over write the RLS. 

write a more complex RLS code

 

 

11 REPLIES 11
AilleryO
Memorable Member
Memorable Member

Hi,

 

Could it be possible to make a pre-consolidated table of your data ?

If you create a calculated table with your consolidated calculations it should not be affected by RLS.

Do not hesitate it this is not clear enough.

Anonymous
Not applicable

do you mean to merge the two tables or to use the function calculatetable?

I was thinking of CALCULATETABLE. That's what I did in a project to keep the display of the percentage of different region, even when RLS was applied to a region.

The RLS should not affect the calcultation of your calculatedtable.

Anonymous
Not applicable

do you have a sample of the code. I will for sure look into the function and try to solve my problem with calculatetable

Hi,

Here is the code to create my consolidated table :

Nb Products (%age byOrigin) =
VAR ListCountry =TREATAS(VALUES(Products[Origin]),Products[Origin])//Create list with level of conso you need
VAR NbProducts =COUNTA(Products[SKU_Number])//Count of product number/ref
RETURN
FILTER(SUMMARIZECOLUMNS
(
ROLLUPADDISSUBTOTAL
(
Products[Origin], "IsCountruSubTotal", ListCountry ),//Create sub totals
"Share in %", //Name of column created
DIVIDE(COUNTA(Products[SKU_Number]),NbProducts )),//Calculation of %age
NOT(ISBLANK(Articles[Origine]))//option (Filter to get rid of blanks)
)

And then I create my visuals based on this table, and not on the original one.


Let us know

Anonymous
Not applicable

It is applied to the User table. 

RLS is ineffective as the arrow points into the Users table. Change the relationship.

Anonymous
Not applicable

i tried making it a one direction between the user and company table but that is not allowed. i tried connecting the user and koncern table directly but that did not solve the problem either

Change the relationship from 1:1 to 1:*  , then you can make it single directional.

Anonymous
Not applicable

i can now change it to single direction but it did not solve the problem

lbendlin
Super User
Super User

Which table is the RLS applied to?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.