Forum Discussion
Filter by userprincialname()
Hello,
I have a dataset used for a variety of reports. One table has a list of users including email address which links to other tables. I would like to add a way to be able to filter by "me" so I could have a report that filtered to the user viewing the data automatically.
I don't think row level security will be the right way to do this as this is just one of dozens of reports, so I don't want to interfere with the rest.
I was using if( email = userprincipalname(), true, false), but you can't use userprincialname() in a column and I can't pull the email field into a measure.
Is anyone able to help? It seems like I'm missing something simple.
Thanks
4 Replies
- AhmedxSuper User
take a look, maybe what is in this video will help you
https://www.youtube.com/watch?v=dXxv39X884Q&t=1s&ab_channel=PowerBIHelpline
- daveeddHelper II
Thanks for the response, I had a look but it's not really applicable.
- v-zhangtiCommunity Support
Hi, daveedd
One way to accomplish this is to create a measure that returns the email address of the current user, and then use that measure in a filter on the email address column.
Here's an example of how to create such a measure in DAX:
CurrentUserEmail = USERNAME()This measure will return the email address of the current user. You can then use this measure in a filter on the email address column like this:
- 1. Add the email address column to the visual you want to filter.
- 2. Click on the filter icon for the email address column.
- 3. Select "Advanced filtering".
- 4. Select "Add filter".
- 5. Select the CurrentUserEmail measure.
- 6. Set the filter type to "is".
- 7. Click "OK" to apply the filter.
This should filter the data to show only the rows where the email address matches the email address of the current user.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- daveeddHelper II
Thanks for the response. Could you confirm where you're doing that? I've tried on both Desktop and Web versions but I can't replicate the steps you've laid out.