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

RLS with related condition using two tables in same role

Hello,

 

I am trying to write a dax for a single role and I want to use fields to create multiple situations using two tables within the same role and same table. I cannot create multiple roles for this condition.  Sample data:

TABLE A

IdA          Colx         Coly
1               D             US
1               I             US
2               D             CA
2               I            IN

 

 

TABLE B

IdB      role      Inter      Dom

1         true      true       false

2         true      false      true

3         true      false      false

4         true

 

Now I want to write one dax such that:

 

( ([RoleS] = TRUE() && Dom = False() || Dom = BLANK()) && ([Inter] = False() || [Inter] = BLANK()))

AND Colx = "D" )

 

OR

 

(

[RoleS] = TRUE()

 

&&

 

(
[Dom] = TRUE() || [Inter] = TRUE()
) && NOT(ISBLANK([Dom])) AND  

Colx = "D" || (Colx = "I" && Coly = "US"

)

 

Table A have many to one relationship with Table B. I need to write one common DAX for both of these situations, or if a third situation is in addition where I want any value for colx or any value for colY.

 

Please help! thanks

1 REPLY 1
lbendlin
Super User
Super User

Sounds like you need to apply your RLS rules to Table A and you need to pull in all three columns from Table B via Power Query lookups. Are you really sure you want to do that? Normal RLS is applied to dimension tables (Table B) and then propagated down via the data model.

 

This part 

 

 ([RoleS] = TRUE() && Dom = False() || Dom = BLANK())

 

most likely does not do what you expect.  I think you wanted to write

 

 [RoleS] = TRUE() && (Dom = False() || Dom = BLANK())

 

See pbix attached

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.