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
yogevz
Helper II
Helper II

Can't Get RLS to Work

Hi all

help!!!!!!!!!!

can't get the RLS to work.

i tried even just 1 table with 3 rows and nothing.

can somebody attach 1 small powerbi file with basic RLS which works?

i will take this file and implement it to my DB.

thanks in advanced...!

1 ACCEPTED SOLUTION

Hi @yogevz,

 

My suggest is use an intermediate table to link these tables.

 

Reference link:

How to create many to many relationships

 

Regards,

Xiaoxin Sheng

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

View solution in original post

8 REPLIES 8
PavelR
Solution Specialist
Solution Specialist

@yogevz there you have.

 

Regards.

Pavel

thanks.

i talked about RLS with username() permissions...

when u have table with users, which is connected to transaction table,

and when user enter - he sees only the record on his username.

Hi @yogevz.

 

At desktop side, you should use "view as role" to enable the rls affect.

 

Capture.PNG

 

Capture2.PNG

 

Regards,

Xiaoxin Shneg

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

this is what i did - but it doesn't work...

see picture 1 - data + i inserted the user as role to see data,

                         u can see also in the lower part the user i am using.

see picture 2 - i get no data. and in the lower part - u can see again the user i used...

what i am missing?

 

1.png2.png

Hi @yogevz,

 

Can you share us a sample file to test?

 

Below is my sample:

 

Role table:

Capture.PNG

 

Measures:

 

USERNAME = USERNAME()

 

Role = LOOKUPVALUE(Sheet2[User],Sheet2[Login],USERNAME()) // look up the role.

 

RLS formula:

 

if(
ISERROR(SEARCH("SalesManager", [Role]))=FALSE(),
[SalesManager]=[Role]
,
[SalesMan]=[Role]
)

 

Regards,

Xiaoxin Sheng

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

attach sample file.

in this file, only when i do as role (attach picture also), then i get 1 row (i am not sure this is what i need to do),

but if this is what i need to do - it doesn't work in the server - when i enter in a different user i need to see

0 rows, but i see all rows...

attach url dropbox to the powerbi file...

 

https://www.dropbox.com/s/nfup6y1p0x62yd5/test%20for%20RLS6.pbix?dl=0

 

3.png

Hi

i succeed doing the RLS.

now - new issue.

from one side - users and department

from second side - fact table, every department has several of rows (table has history).

now - i can't create join between the tables!

powerbi doesn't permit join between 2 tables with many values (many to many).

what now??

 

Hi @yogevz,

 

My suggest is use an intermediate table to link these tables.

 

Reference link:

How to create many to many relationships

 

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.