Forum Discussion
Dynamic RLS - USERPRINCIPALNAME returning more than 1 criterium
- 1 year ago
hi , you should create a users and users and their variables (Supervisor and Functions) table for this , this variable table should include two column users & all the variables related to that user
and then create a relationship between user and variable table
And create this measure
SelectedValuesFilter3 = VAR SelectedValues = VALUES('User&Sup&Fun'[Value]) VAR MatchFound = SUMX( SelectedValues, IF( CONTAINSSTRING( MAX(Table2[PathF]),'User&Sup&Fun'[Value] ), 1, 0 ) ) RETURN IF(MatchFound > 0, 1, 0)I have create a new path column called pathf in here without the first part of the path but if you need it as well you can use the orginal path & Table2 include your main table name in there
And include this measure into your table filter and say you only need to see 1
And apply RLS to users table and it should work
Hi,
I would suggest that you create a users table for this and apply RLS to both
the test i did
RLS dax codes
OR(
CONTAINSSTRING(
'DIM-Organogram'[PathRLS],
MAXX(
FILTER('Users', 'Users'[Organogram.Email] = USERPRINCIPALNAME()),
'DIM-Organogram'[Supervisor]
)
),
CONTAINSSTRING(
'DIM-Organogram'[PathRLS],
MAXX(
FILTER('Users', 'Users'[Organogram.Email] = USERPRINCIPALNAME()),
'DIM-Organogram'[FunctionRRnr]
)
)
)[Organogram.Email] ==USERPRINCIPALNAME()
before view as
after view as [email protected]
- Nico_Beckers1 year agoFrequent Visitor
Hello kushanNa
This solution will filter my dataset starting with the email address of the Userprincipalname. So only the lines containing that email address will be visible right?
I need my RLS to check the content related to the user email address; the info in the supervisor column, and in the FunctionRRnr column, take that information and check with Pathcontains if that info is in the Path. So the content of Organogram.email should not be filtered.
So [email protected] has 2 rows in the dataset. Supervisor column contains A and B, FunctionRRnR column contains C and D. Now I want my RLS to take A, B, C and D and check where any of those is present in my Path and only show the rows where the Path either contains A, B, C or D
- kushanNa1 year agoSuper User
is it possible for you to create a sample table and an expected output table?
- Nico_Beckers1 year agoFrequent Visitor
So if I login as [email protected] I want the yellow cells to be used as criteria for filtering the PathRLS column. Only show if it contains at least one of those criteria.
Outcome:
Dataset:
Organogram.email PathRLS Supervisor FunctionRRnr [email protected] SSPV1|Function1 Spv1 Function1 [email protected] SSPV2|Function2 Spv2 Function2 [email protected] SSPV1|Spv2|Function3 Emp1 Function3 [email protected] SSPV1|Spv2|Function3 Emp2 Function3 [email protected] SSPV1|Spv1|Function5 Emp3 Function5 [email protected] SSPV3|Spv3|Function6 Spv3 Function6 [email protected] SSPV3|Spv1|Function5 Emp4 Function5 [email protected] SSPV2|Spv3|Function3 Emp5 Function3