cancel
Showing results for 
Search instead for 
Did you mean: 
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
RicoZhou
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
RicoZhou
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

Thank you! it's works properly.

Hi!

Thank you.

I will test it and then comment if it works.

Helpful resources

Announcements
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Urdu Hindi D365 Bootcamp 768x460.png

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors