Forum Discussion
RLS problem with dynamic title for report
- 6 years agoHi there
What if you had to have the SELECTEDVALUE measure which would just use the default for example:
SELECTEDVALUE('Providers'[Provider],"All Providers") - 6 years ago
Hi Gilbert
Thank you that worked. A good example of occam's razor!
The reason my code did not work is the use of NOT ISFILTERED. I had assumed wrongly that the PBI service engine would apply a filter by Provider. Not so. The reason your solution works is because as we know SELCETEDVALUE is just syntax sugar for:
IF ( HASONEVALUE ( Table[column] ), VALUES ( Table[column] ), "default value" )So .
SELECTEDVALUE('Providers'[Provider],"All Providers")looks for one value, not to see if Provider is filtered.
Other replies to my post advising the use of USERPRINCIPLENAME() or USERNAME(), are wide of the mark because this approach only adds value if one wants to filter to an individual user. In my case I only need to filter RLS by an AAD security group, and the users within the relevant [Provider] AAD security group see only what RLS defines for that security group.
However, a Use case for a dynamic title for a user or all users would be SELECTEDVALUE([User],"All users")
where [User]. =USERPRINCIPALNAME() as long as the model is set up correctly.
Thanks again
Tony
This post is not clear of what do you want to achieve. This is the correct measure when create a slicer with [Provider], you can switich providers name by selecting providers in the slicer. But any measures on the report has nothing to do with the RLS role setting.
If you want to show a "title" corresponds to each provider when providers open the report. This should be a case of Dynamic RLS, you can use Username() or Userprinciplename() to achieve this.
https://community.powerbi.com/t5/Community-Blog/Dynamic-Row-Level-Security-Dynamic-RLS/ba-p/787399
Paul Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.