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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
MiKeZZa
Post Patron
Post Patron

Check filtervalues based on USERPRINCIPALNAME()

 
Hi all,
 
At this moment we add a field to our datasets with this declaration: UserMail = USERPRINCIPALNAME()
 
And we also add the mailadress of the people that are responsible for a departement to the dataset as well. In manage roles we have this DAX-statement: [MailFieldOfResponsiblePerson] = [UserMail]
 
This takes care of filtering the data. This worked fine untill now, but now we want to make an other choice. We don't want to filter out all the other data from now on. We now want to present ALL the data, also the data from over departments. But we want, in the default view that opens when you open a dashboard, to have a filter with all the mailadresses (or names that are distracted from the mailaddresses) with the value that equals USERPRINCIPALNAME() selected. 
 
Is this possible?
 
6 REPLIES 6
v-sihou-msft
Microsoft Employee
Microsoft Employee

@MiKeZZa

 

Based on your description, I still can't understand your requirement.

 

If you already apply the row level filter, when applying row level security, the table context is already filterd, you can't display all records and have it filtered by other filter or slicer.

 

Regards,

Hi Simon_Hou,

 

At this moment we're filtering on row level. But we wan't to change this to a situation where all records are available for a user. But we're trying to keep it as clean as possible and don't want all the information to be displayed to all users by default, but only when they'll look for it themself.

 

Let's say this is my dataset:

RecordID       Mailadress           Value

1                    x@domain.com  2

2                    y@domain.com  5

3                    x@domain.com  4

4                    z@domain.com  3

 

So current situation (for user x@domain.com) is that he sees record 1 and 3. But we want to provide him to possibility to display all 4 records, but the default view when opening the report must provide the values for record 1 and 3.

 

The best solution for us is that in a filter (where all users are available) x@domain.com will be selected. But I'm afraid this doesn't work. An alternative for us is a trick with a measure that displays the values of record 1 and 3, unless a slicer (named DisplayOnlyMyOwnDepartment) is set to 'No' or something.

 

But I don't know what can be made...

 

 

@MiKeZZa

 

In this scenario, you can define two roles in Row Level Security . One for those "general users" and apply dynamic row level filter on this table based on USERNAME(). The other one is for that "super user" without any row level filter.

 

Regards,

Yes I know I can do that. But for the superusers I also want their own department to be to only one to be displayed default. The other departments must be available in data, but not displayed when opening the dashboard....

MikeZZa, were you able to resolve this?  I'm trying to implement the same thing and struggling how to set a default view based on the viewer but not restrict with RLS.

No. It's not possible (at the moment)....

 

You can vote for this on: https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/13926666-provide-username-functio... and then we'll have to wait.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.