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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AnnaWho
New Member

HELP Please: Show the Data But Not All the Details (Data Filtering Based on USERPRINCIPALNAME?)

Hello,

I have a table that shows production and I would like all employees to see everyone's production but only see their own name (the rest of the names should be blank). This I have achieved using this DAX below. However, if the user logged in is a supervisor (the Employees table has a Supervisor column with a Yes or No value), there should be no filters and he/she should see all data. In the screenshot below, if Princess Leia is a supervisor, she should see all the Employee Names. Also, the supervisor may or may not have production numbers in the table. Any suggestions for how to do this? I would appreciate any help please.

 

EmployeeName =
IF(
    SUM('Production'[Quantity])
    &&
    SELECTEDVALUE('Employees'[LogInEmail])=USERPRINCIPALNAME(),
    SELECTEDVALUE('Employees'[Name])
   
)
Here's how it looks - Darth Vader is the user currently logged in. After I took this screenshot, I made Darth Vader a Supervisor and I want all the Employee Names to display instead of just his own name.
AnnaWho_1-1701828577457.png
 
Data tables:
Employees:
AnnaWho_0-1701875324096.png

Production:

AnnaWho_1-1701875364063.png

 

I thought about maybe having a separate Supervisor table that contains a list of supervisors?

AnnaWho_2-1701875477894.png

 

 

Thanks in advance!
3 REPLIES 3
lbendlin
Super User
Super User

You need two copies of your fact table. One table is visible without names.  You create measures for "Mine"  and "Others".  The other table is hidden and has the names. Use RLS to control access to the hidden table.

Thanks! Do you know how I would go about using RLS to access to access the hidden table? When I tried this, it still filtered the hidden the table and only showed me my data. I think it's because under Manage Roles, my table filter is [LogInEmail] = USERPRINCIPALNAME()? Do you know what I should use? I'm fairly new at Power BI & DAX... appreciate any help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors