Forum Discussion

cbarriascb's avatar
cbarriascb
New Member
5 years ago
Solved

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 ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    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:

    User Table:

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

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

    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.

    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.