Forum Discussion
Hide Field parameter dimension using User role
Hi All,
I have user table as below
| User | Group |
| [email protected] | A |
| [email protected] | B |
Then I have created field parameter as below.
Dowload a PBIX solution from my Onedrive
Build your relationships like this and then click Manage Roles
Create a security role
Test by clicking on View As and sleecet the role and the Other User
Learn more about row level security and file parameter here
https://learn.microsoft.com/en-us/power-bi/guidance/rls-guidance
https://www.youtube.com/watch?v=NOgTiRitX8o
Please click thumbs up for these suggestions,
and click Accept Solution if any work.
Thank you
5 Replies
- bhanu_gautamSuper User
Create a measure to dynamically filter the field parameter based on the user's group:
SelectedDimension =
VAR CurrentUser = USERPRINCIPALNAME()
VAR UserGroup = LOOKUPVALUE('User'[Group], 'User'[User], CurrentUser)
RETURN
SWITCH(
UserGroup,
"A", "Country",
"B", "State",
BLANK()
)Use the measure to filter the field parameter in your report. You can use this measure in a visual level filter or in a calculated column to dynamically show the appropriate dimension based on the user's group.
- speedrampsSuper User
Dowload a PBIX solution from my Onedrive
Build your relationships like this and then click Manage Roles
Create a security role
Test by clicking on View As and sleecet the role and the Other User
Learn more about row level security and file parameter here
https://learn.microsoft.com/en-us/power-bi/guidance/rls-guidance
https://www.youtube.com/watch?v=NOgTiRitX8o
Please click thumbs up for these suggestions,
and click Accept Solution if any work.
Thank you
- rob_vander2Helper II
speedramps I did this but when I publish this and user login in power bi service, they still see both dimension from field parameter
- speedrampsSuper User
Build and test in Power BI Desktop first ok.
If it then does not work in Power BI Service then there are usually 2 reasons:-
The users should only have Read access to the dataset and workspace, otherwise they can override RLS.
The users needs adding as a member to the security group.
- Please accept the solution I gave you because it does work 100%. You are now drifting into a new question about Read access. Thanks.
Learn about RLS here
https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security
- speedrampsSuper User
Hi rob_vander2
Please can you click the thumbs up button and accept the solution.
I provide a solution with example and text screen shots proving it works 100%.
Please follow the instruction I provided to build and test RLS in Power BI Desktop first. If it does not work in Desktop then copy the logic more carefully and it will work !
Then publish to Power Bi Servce and add the users to the security role. Learn how here
Then validate it in Power BI Service using "Test as role". Learn how here
https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security#validating-the-role-within-the-power-bi-serviceIf it does not work then it is because your users have the incorrect permissions.
RLS only restricts data access for users with Viewer permissions. It doesn't apply to Admins, Members, or Contributors. Go into the Power Bi Service and look what access the user have to the workspcae and dataset, and edit them accordingley.
Then ask the users to try with their own login.
If it does not work, then wait at least 1 hrs for the Power BI Service to replicate the permissions changes in the cloud.
If it still does not work then check the user error message carefully. Do they have license?
Thanks