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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Scocal123
Helper I
Helper I

Crossfilter and row level security

Hello,

 

I have the following model for a report:

Scocal123_1-1670323115087.png

I've been asked to implement RLS and I'm having some trouble figuring out the correct method. 

 

In my original model table 1 does not exist and is not required. Table 1 is added for RLS amd contains a list of users email addresses, and the IDs which represent the rows I want the fact table, table 2, to filter to. One ID can be accessed my multiple users in table 1 which is why it is a many>many relationship. The RLS is setup to use Userprinciple name to filter table 1 and subsequently table 2. This element seems to work fine, as I can see when RLS is applied, table 2 does filter to the correct IDs the person in table 1 has access to. Due to table 2 being the fact table and on the many of the many>one side, it does not pass these filters through to the associated dimension tables. 

 

I have been reading into this as it is new to me, and thought I could use crossfilter within my measures to make the filters flow through to the dimension tables. As an example, for a measure that counts the rows in table 3 I thought I could try something like the below to count the total rows in table 3, but only for the rows which match those filtered in table 2:

 

CountRowsTable3 = CALCULATE(

                        COUNTROWS(Table3),

                        CROSSFILTER('Table2'[ColumnA],Table3[ColumnA],Both)

 

When I do this calc I still get the total number of rows in table 3 without the RLS applied. 

 

Grateful for any steers on the best way to do this, or if I am down totally the wrong track happy to be told so too!

Thank you

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Scocal123,

I'd like to suggest you check the relationship direction to confirm these filter effect can correctly apply through these table relationship mappings.(single direction relationship only work on one side, you may need to modify some of them to both direction)

What is the Direction of Relationship in Power BI? - RADACAD

Regards.
Xiaoxin SHeng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you for the response.

I have tried your suggestion. In the example above, when I use 'View as role' to check the RLS, I can see that table 1 filters to 2 rows with 2 IDs which is correct. These 2 IDs from table 1 succesfsully filter table 2. I have set the relationship direction to 'both' between table 2 and 3, but it does not perform any filters on table 3 and I am struggling to understand why. Any advice would be appreciated. 

Kind Regards

HI @Scocal123,

It sounds strange, I'd like to suggest you extract these three table to a standalone report to exclude other filter effects and try again.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors