Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jomu
Helper I
Helper I

Filter out rows based on loged in user

Hi,

I struggle with an issue and did not find a solution until now. Maybe someone could help me.

 

There is a dimension table: DimPlaces

DimPlaces hold mainly cities like London, Berlin, Rome, Madrid, Boston etc.

 

Now different uses can use my report and the log in via the cloud. Which uses accesses the report is easy to find out. I implemented a measure CurrentUser := USERNAME()

 

Then I want to filter out some rows from DimPlaces based on the current user.

For this I had an additional table UserPlaces like:

Mike – London
Mike – Madrid
Pedro – Rome
Herbert – Berlin
Herbert – Rome

 

My measure tells me which use is active, I can find out the cities for this user but how to filter out the entries in DimPlaces that the user should not see?

 

Any advices?

Best regards

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @jomu 

So what you're trying to achieve is called RLS (short for Row-level Security). Fortunately, you have everything you need to implement RLS, so do the following:

Create a relationship between your two tables DimPlaces and UserPlaces with City as the connection column. 
Then go to Modeling -> Manage Roles and create a new role for your UserPlaces tables. Here you can create a simple DAX saying something like Name = USERNAME()

This will filter your UserPlaces table, which will then filter your DimPlaces due to the relationship between them. 

Hope this helps!

View solution in original post

v-frfei-msft
Community Support
Community Support

Hi @jomu ,

 

Please refer to the online document about setting RLS.

https://docs.microsoft.com/en-us/power-bi/desktop-rls 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @jomu ,

 

Please refer to the online document about setting RLS.

https://docs.microsoft.com/en-us/power-bi/desktop-rls 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi @jomu 

So what you're trying to achieve is called RLS (short for Row-level Security). Fortunately, you have everything you need to implement RLS, so do the following:

Create a relationship between your two tables DimPlaces and UserPlaces with City as the connection column. 
Then go to Modeling -> Manage Roles and create a new role for your UserPlaces tables. Here you can create a simple DAX saying something like Name = USERNAME()

This will filter your UserPlaces table, which will then filter your DimPlaces due to the relationship between them. 

Hope this helps!

Yes, that's a solution.

 

The only issue here (well, not really an issue ...) is, that security is not a concern in this project. It is just a question about usability - there are many places and a user should not see places (for selection) that he does not need.

Thanks to you I can realize this via security.

 

Regards,

jomu

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.