Intermediate: Dynamic Regional Security and Inactive Relationships
Understand it in simple language
Static roles are a useful first exercise. A larger deployment often maps signed-in users to authorized regions. USERPRINCIPALNAME returns the user principal name in the relevant environment; never infer security from a name displayed in a report title. Multiple role memberships can broaden access, so test effective permissions.
An inactive ShipDate relationship is a modeling choice, not a security rule. USERELATIONSHIP can activate it for a measure; it does not repair an incorrectly secured model.
Do it step by step
- Make a synthetic UserRegion table with UPN and Region. Use test account identifiers, never passwords.
- Create a Regions dimension containing unique North and South values and relate it to Sales with one-to-many Single filtering.
- In Manage roles, filter Regions with an expression based on the authorized mapping, for example
Regions[Region] IN SELECTCOLUMNS(FILTER(UserRegion, UserRegion[UPN] = USERPRINCIPALNAME()), "AllowedRegion", UserRegion[Region]). Secure the mapping table itself if consumers can query it; do not expose other users' entitlements. - Publish to training, assign role membership and test one-region, two-region and unmapped Viewer accounts. Unmapped must return no sales.
- In a separate modeling exercise, add synthetic ShipDate values, create an inactive Date-to-ShipDate relationship, and test
Shipped Revenue = CALCULATE([Revenue], USERELATIONSHIP('Date'[Date], Sales[ShipDate])). - Compare order-date and ship-date results under the same Date slicer.
Check your result
Run negative security tests: a North-only viewer must not retrieve a South detail row through another report or permitted query path.
If something goes wrong
Dynamic-security implementations vary by model and storage mode. Review the mapping-table exposure, role membership and actual identity before release.
Practice data and learning method
Industry practice collection: downloadable retail, finance, HR and operations datasets, dictionaries, full walkthroughs and answer sheets. The cases contain multiple years, multiple related tables, deliberate data defects and known-answer checks. Progress from the small foundation files below to these cases; do not reuse the foundation totals for the larger datasets.
Download Sales.csv, Products.csv, and the dataset guide. These files contain synthetic training data, not real customers. Use the Power BI virtual labs for guided browser practice. Each lab states its supported operations. Then repeat the procedure above in the actual Microsoft tools and save evidence of your result. Try another filter or an intentionally incorrect setting and explain what changed before moving on.
Guided practicals for this topic
Virtual lab · Microsoft Power BI · 35 min
Test mapped, unmapped and editing access
Hands-on hr case: load the downloadable CSV tables, perform the actions, inspect the full-data result and reconcile it. Includes a paired Desktop procedure.
Continue learning from Microsoft
Power BI documentation · DAX reference · Power Query M reference · Power BI analyst skills map. Features, licensing, menus and availability can change; check the relevant official page for your environment.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.