Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi Experts,
I want to create a slicer with the below values based on the user login details
You and Others.
Solved! Go to Solution.
hi @Anonymous
you can create a table as follows :
and add "you" and "others" in a column of ths table as follows:
and use this as a slicer in your report. then you should add a measure like the following in your visuals level filter pane or page level filter pane and set it to 1.
If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly.
You will need USERPRINCIPALNAME() when creating a RLS role but the user emails must exist in your data. For example, rows 1-10 are for user01@domain.com while rows 2-20 are for user02@domain.com
Without this information, there's no way you can use USERPRINCIPALNAME() for RLS. Again, your data must indicate which records belong to whom.
hi @Anonymous
you can create a table as follows :
and add "you" and "others" in a column of ths table as follows:
and use this as a slicer in your report. then you should add a measure like the following in your visuals level filter pane or page level filter pane and set it to 1.
If this post helps, then I would appreciate a thumbs up 👍 and mark it as the solution to help the other members find it more quickly.
Hi @Selva-Salimi, but this approach will restrict the data, correct? Instead, I want the user to be able to choose using filter options directly on the dashboard.
@Anonymous , no that does not restrict the data, user can choose to see his/her data by choosing you and others by choosing others in the slicer.
please share more details of your issue as you use my solution
Hi @Anonymous
To achieve this, you can use a method similar to Row-Level Security (RLS) by creating a calculated column or measure that dynamically determines whether a record belongs to the currently logged-in user or to others. Here's how you can do it:
Steps:
Use the USERNAME() or USERPRINCIPALNAME() Function: These DAX functions return the currently logged-in user's username or email. For example:
USERNAME() returns the username in the format DOMAIN\User.
USERPRINCIPALNAME() returns the email address or UPN of the user (preferred for cloud-based models).
Create a Calculated Column: In the dataset where the user information is stored, create a calculated column like this:
DAX
Copy code
UserGroup =
IF(
Table[LoginEmail] = USERPRINCIPALNAME(),
"You",
"Others"
)
Replace Table[LoginEmail] with the column that contains the user email or login details.
Use the Column in a Slicer: Add the UserGroup column to a slicer in your report. The slicer will show two options: "You" and "Others."
Optional: Use a Measure Instead: If you prefer not to create a calculated column, you can achieve this with a measure. For example:
DAX
Copy code
UserGroupMeasure =
IF(
MAX(Table[LoginEmail]) = USERPRINCIPALNAME(),
"You",
"Others"
)
Then, you can use this measure in a visual or as part of your filters.
Limitations:
This approach works best in scenarios where the dataset includes a column with user-specific information (e.g., emails).
If you want to enforce access restrictions, you'll need to configure RLS in addition to this slicer.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
You will need USERPRINCIPALNAME() when creating a RLS role but the user emails must exist in your data. For example, rows 1-10 are for user01@domain.com while rows 2-20 are for user02@domain.com
Without this information, there's no way you can use USERPRINCIPALNAME() for RLS. Again, your data must indicate which records belong to whom.
Hi @Anonymous ,
you can achieve the desired Output using a calculated column.
Here's how:
Steps to Create the Slicer:
Final Output
When a user logs in, they will see "You" for their data and "Others" for other users' data in the slicer.
The slicer allows them to toggle between viewing their data or others' data.
If you want to restrict data visibility based on the logged-in user Please let me know we can Implement that also
I hope the provided solution works for you
If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.
@grazitti_sapna , we cant use USERPRINCIPALNAME() in calculated columns in Power BI.
Hi @Anonymous ,
You're absolutely correct! USERPRINCIPALNAME() cannot be used in calculated columns because calculated columns are computed during data refresh and are static. This means they do not respond dynamically to the logged-in user.
Instead of creating a Calculated Column we should Create Measure : Use a measure to dynamically evaluate whether the current row is for the logged-in user.
DAX
SlicerValue =
IF(
SELECTEDVALUE(YourTable[UserEmail]) = USERPRINCIPALNAME(),
"You",
"Others"
)
Use the Measure in a Visual:
This way, slicer adapts to the logged-in user, without requiring RLS or calculated columns.
I hope the provided solution works for you
If I have resolved your question, please consider marking my post as a solution. Thank you!
A kudos is always appreciated—it helps acknowledge the effort and keeps the community thriving.
In this context, it is simply because Power BI doesnt' allow USERPRINCIPALNAME to be used in a calculated column. An attempt to do so will throw an error.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.