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
cbarriascb
New Member

User Privileges on Data

Hi Everybody!

I create a report that execute a database query: For Example table: "Sales". "Select user, date, usd from sales"

The report is a table that show all field of the query.

I have other table with the users and power bi account users: "Select user, pbiuser from users".

 

I need when the user A@onmicrosoft.com entry to the report, he only has access to his data. He can't see the other users data.

 

Is it possible to filter the data to show in the report, according to the logged in user?

 

Best regards,

----------------------------------------

Hola a todos!

Les cuento mi caso:

Genere un reporte que consulta una base de dato: Por ejemplo tabla "Sales". "Select user, date, usd from sales"

El reporte es una tabla que muestra todos los campos de la consulta.

Tengo otra tabla (Users) con los usuarios y su cuenta de power bi:

 

Quiero que cuando ingrese el usuario A@onmicrosoft.com, vea el reporte solo con los datos del usuario A.

 

¿Es posible realizar ese filtro?

¿Se puede realizar un filtro sobre los datos de acuerdo al usuario logueado que ejecuta el reporte?

 

Desde ya muchas gracias.

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @cbarriascb 

From your statement, I think you want to restrict users to see the data by their account. You may want users can only see the data which they have access to.

Please try Dynamical RLS in Power BI to achieve your goal. Row-level security (RLS) with Power BI can be used to restrict data access for given users. Filters restrict data access at the row level, and you can define filters within roles. 

I build a sample to have a test.

Data Table:

1.png

User Table:

2.png

We need to build a relationship between ID columns(Key column) in two tables.

1.png

Then we find Manage Roles in Modeling ,build a new role and create Dax code.

1.png

Dax Code:

[ID] = 
CALCULATE (
    MAX(Data[ID]),
    FILTER (
        User,
        User[email] = USERPRINCIPALNAME()
            && User[ID] = Data[ID]
    )
) 

Let's have a test by View as function.

2.png

It works well. Then we can publish this report to Service. And we need to add users in Role in Dataset Security.

For more details: Manage security on your model

Users should only have view permission to dataset. If they have edit permission, RLS couldn't restrict them any more. 

For reference: Row-level security (RLS) with Power BI 

Dynamic Row Level Security with Power BI Made Simple

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

View solution in original post

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @cbarriascb 

From your statement, I think you want to restrict users to see the data by their account. You may want users can only see the data which they have access to.

Please try Dynamical RLS in Power BI to achieve your goal. Row-level security (RLS) with Power BI can be used to restrict data access for given users. Filters restrict data access at the row level, and you can define filters within roles. 

I build a sample to have a test.

Data Table:

1.png

User Table:

2.png

We need to build a relationship between ID columns(Key column) in two tables.

1.png

Then we find Manage Roles in Modeling ,build a new role and create Dax code.

1.png

Dax Code:

[ID] = 
CALCULATE (
    MAX(Data[ID]),
    FILTER (
        User,
        User[email] = USERPRINCIPALNAME()
            && User[ID] = Data[ID]
    )
) 

Let's have a test by View as function.

2.png

It works well. Then we can publish this report to Service. And we need to add users in Role in Dataset Security.

For more details: Manage security on your model

Users should only have view permission to dataset. If they have edit permission, RLS couldn't restrict them any more. 

For reference: Row-level security (RLS) with Power BI 

Dynamic Row Level Security with Power BI Made Simple

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

Thank you! it's works properly.

Hi!

Thank you.

I will test it and then comment if it works.

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.