PL-300 · Question #339
You have a Power BI data model that contains a table named Employees. The table has the following columns: - Employee Name - Email Address - Start Date - Job Title You are implementing dynamic…
The correct answer is D. [Email Address] = USERPRINCIPALNAME(). For dynamic RLS where users only see their own data, use USERPRINCIPALNAME() to match the user's email address against the [Email Address] column.
Question
You have a Power BI data model that contains a table named Employees. The table has the following columns:
- Employee Name
- Email Address
- Start Date
- Job Title
You are implementing dynamic row-level security (RLS). You need to create a table filter to meet the following requirements:
- Users must see only their own employee data.
- The DAX expression must work in both Power BI Desktop and the Power
BI service. Which expression should you use?
Options
- A[Email Address] - USERNAME()
- B[Employee Name] - USERPRINCIPALNAME()
- C[Employee Name] = USERNAME()
- D[Email Address] = USERPRINCIPALNAME()
How the community answered
(46 responses)- A13% (6)
- B9% (4)
- C4% (2)
- D74% (34)
Why each option
For dynamic RLS where users only see their own data, use `USERPRINCIPALNAME()` to match the user's email address against the `[Email Address]` column.
The hyphen (`-`) is a subtraction operator, not a comparison operator, making the DAX expression invalid for filtering.
The hyphen (`-`) is a subtraction operator, and comparing an employee name to a UPN (email address) would not result in a valid match.
`USERNAME()` might return inconsistent values across environments and comparing `[Employee Name]` to a UPN (email address) is incorrect for matching.
`USERPRINCIPALNAME()` returns the User Principal Name (UPN), which is typically the user's email address, consistently in both Power BI Desktop and the Power BI service. By equating the `[Email Address]` column to `USERPRINCIPALNAME()`, only rows corresponding to the logged-in user's email address are displayed, fulfilling the dynamic RLS requirement.
Concept tested: Dynamic Row-Level Security (RLS) with DAX
Source: https://learn.microsoft.com/en-us/power-bi/enterprise/service-admin-rls-dynamic
Community Discussion
No community discussion yet for this question.