🔄 Dynamic Row-Level Security (RLS) in Power BI

 Dynamic RLS lets you automatically filter data based on the logged-in user's identity, without hardcoding user roles. It’s scalable, secure, and highly useful in multi-user environments.


🧠 How It Works

1️⃣ Create a User Mapping Table (e.g., UserRegion)

plaintext

Username | Region -------------------|-------- alice@domain.com | North bob@domain.com | South

2️⃣ Establish a relationship between the UserRegion table and your main data (e.g., Sales).

3️⃣ Define a DAX Filter on the role:

Dax

[Username] = USERPRINCIPALNAME()

👤 Power BI dynamically matches the signed-in user with the corresponding row in the table.


📦 Setup Steps

  1. Create UserRegion table

  2. Link it to your main data model

  3. Go to Manage Roles → Add filter using USERPRINCIPALNAME()

  4. Publish to Power BI Service

  5. Assign security roles in the dataset settings



🔐 Example Scenario

Bob logs in → Power BI checks UserRegion → Filters Sales to only show data where Region = "South" 👇

✅ No separate reports
✅ One dataset
✅ User-specific data control

Comments