Forum Discussion

Anony_mous's avatar
Anony_mous
Frequent Visitor
2 years ago

Access restrict based on userlogged in

Hello Team,

I am new to power bi I got a requirement like I need to restrict the access based on organizational heirarchy. let's say I have a card visual in that I am showing the total trainings completed.If a user clicks on that card it will take a user to a backend table where it will show the total number of trainings completed for his or her  based on  organizational role.if a specific user Email is not existing in ManagerEmail column it is not showing we can't add email because it is a organization heirarchy .As of now I am selecting the backend table and applying the filter on this visual by passing a measure and giving value greater than 0 since I am writing the DAX like this:

test =
VAR A= USERPRINCIPALNAME()
return
    COUNTROWS(FILTER('Table1','Table1'[ManagerEmail]=A ||'Table1'[L3] = A || 'Table1'[L2] = A ||'Table1'[L1] = A)),1)
 
Assume [email protected] is the developer email he has to see the complete dashboard Other than developers few users need to see the  complete dashboard as well As of now it is working fine if we give only 1 email in the dax that is [email protected] but can't add more email. how to alter the DAX I wrote or Is there a possible way around.Please give some solutions all suggestions are welcome thank you in advance!!
Regards,
Anony_mous

1 Reply

  • Hello

     

    It sounds like you need to look into using Row-Level Security (RLS).

     

    In Power BI Desktop, go to Modeling > Manage Roles and press Create. From there, you can add filters to the data tables you want to restrict by clicking on the ellipsis next to the table name and adding a DAX experssion. For example, you might use a DAX expression like [ManagerEmail] = UserPrincipalName() 

     

    You can test by clicking Modeling > View As and typing in an email address.

     

    Once you've created the role, you do then need to assign people to the roles in the Power BI Service (click on the ellipsis next to the data set and select Security)