Static and dynamic RLS
Design a row filter on a dimension
A role filter is a Boolean DAX expression evaluated for rows of a model table. Static RLS uses a fixed allowed value. Dynamic RLS derives allowed rows from the effective identity and an entitlement table. Prefer filtering a dimension and propagating that restriction through active relationships. This exercise assumes Import mode, not DirectQuery calculated-column or role-expression compatibility.
Model and role setup
Load regions.csv, sales.csv, and user-region.csv as Region, Sales and UserRegion; set Region[RegionKey] and Sales[RegionKey] to text, Sales[Revenue] to whole number. Region is the unique one side; create active single-direction relationships from Region to Sales. Keep UserRegion disconnected for this particular explicit lookup pattern. In Manage roles, place a filter on Region for each role. For DynamicRegion also filter UserRegion itself to the current identity; a hidden mapping table alone would not protect entitlement rows. The synthetic mapping is already normalized to UPN values; reject empty, duplicate or unknown keys upstream.
DynamicRegion filter on UserRegion:
UserRegion[UPN] = USERPRINCIPALNAME()DynamicRegion filter on Region:
VAR CurrentUPN = USERPRINCIPALNAME()VAR CurrentRegion = Region[RegionKey]RETURN NOT ISBLANK(CurrentUPN) && COUNTROWS( FILTER(UserRegion, UserRegion[UPN] = CurrentUPN && UserRegion[RegionKey] = CurrentRegion) ) > 0The role returns false for a missing mapping. USERPRINCIPALNAME() yields the effective UPN, which need not equal a directory mail alias. Test actual guest identities separately. The explicit membership lookup avoids a bidirectional relationship in this small example; a relational bridge design requires a carefully tested security propagation path and no ambiguous paths.
Example 1 — static region roles
Create StaticNorth with Region[RegionKey] = "N" and StaticSouth with Region[RegionKey] = "S". In both roles set the UserRegion table filter to FALSE() so the entitlement table is not exposed. The active Region-to-Sales relationship restricts facts: North returns S01/S02 (160); South returns S03/S04 (120). A region selector cannot reveal other rows. A measure CALCULATE([Revenue], REMOVEFILTERS(Region)) cannot remove the security restriction.
Example 2 — dynamic membership
Assign north@example.invalid to DynamicRegion: N grants USD 160. multi@example.invalid maps to N and S: four rows, USD 280. unknown@example.invalid is assigned to the role but has no matching mapping: zero rows; SUM of Revenue is BLANK, not proof of zero sales. Duplicate grants must be rejected during entitlement ingestion; the membership predicate itself does not multiply facts. The static and dynamic examples share a model only for testing; use a single reviewed role design in a real deployment.
Multiple roles and relationship mistakes
Roles combine by union of their grants, not by intersection. StaticNorth plus StaticSouth permits N and S. A DenyAll role (FALSE() on Region and UserRegion) combined with StaticNorth still permits North. A permissive role can expose rows despite a second restrictive role. Test relationships as active; an inactive relationship does not convey RLS. Do not solve an entitlement problem by switching every relationship to Both. A physical bridge alternative may require Apply security filter in both directions on the relevant edge, but test it in a separate model. RLS is not object-level protection; a different table without a security path needs its own review.
Practice and documentation
Predict rows and revenue for each identity, then run python verify.py from the lab. Add a West grant to the multi user in a disposable copy and predict 400. Explain why unknown identity must never default to all regions.
Documentation reviewed 2026-11-29 (page text or search extracts); native execution and installed build NOT RUN.
- https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security
- https://learn.microsoft.com/en-us/power-bi/guidance/rls-guidance
- https://learn.microsoft.com/en-us/dax/userprincipalname-function-dax
- https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-relationships-understand