PREP WITH PROOF
Menu
CERTIFICATION STUDY GUIDES / PRACTICAL GUIDE

PL-300 Power BI Lab: Fix DAX Grand Totals and Test Row-Level Security

Build a three-row Power BI model for PL-300, calculate the correct DAX margin total, and test dynamic regional access with row-level security.

THE QUICK ANSWER

Calculate margin percentage as total gross profit divided by total revenue in the current filter context. In a model with regional access, use row-level security on a dimension that filters your sales facts, then verify expected and forbidden rows for each identity. These two checks catch different mistakes: an incorrect calculation and an incorrect access boundary.

Create a Power BI practice dataset with known answers

In Power BI Desktop, add a Sales table with Order ID, Region Key, Revenue, and Cost. Use three rows: N01, North, 100, 40; N02, North, 900, 810; and S01, South, 200, 100. Create DimRegion with one row each for North and South, then add a one-to-many relationship from DimRegion to Sales using Region Key. Use the dimension column for slicing the report and confirm that the relationship is active.

In North, the first order earned 60 and the second earned 90. North has 150 in gross profit and 1,000 in revenue, so the margin is 15%. South has 100 in profit on 200 in revenue, so the margin is 50%. With both regions visible, gross profit is 250 and revenue is 1,200, so the total margin is about 20.83%. Write down these numbers before creating any measures.

Calculate a weighted margin in DAX filter context

Define the measures with SUM and DIVIDE. Add a matrix with region on the rows and the margin measure as a value. Power BI evaluates the measure again for the grand total in the aggregate filter context. If you remove a region through a slicer, the total should recalculate using just the eligible sales.

A tempting formula averages the order margin percentages. For North it returns 35%, because it weights the 100 and 900 revenue orders equally. That formula answers a separate question about the average order margin. In this exercise the business requirement is margin on all relevant revenue. Use both formulas side by side and write a one-sentence description for each. If they happen to match on another test, add orders with very different revenues and margin rates to reveal the difference.

Revenue = SUM(Sales[Revenue])
Gross Profit = [Revenue] - SUM(Sales[Cost])
Margin % = DIVIDE([Gross Profit], [Revenue])

Trace the filter path before changing the measure

Change the regional slicer from North to South and inspect row count, total revenue and total profit before looking at the percentage. A South-only result should show one order, revenue of 200, and profit of 100. If the amounts remain 1,200 and 250, check that the visual uses DimRegion, that keys match, and that the active relationship allows the dimension to filter the fact table.

Suppose the business adds a promotion table and a single order can use two promotions. If an analyst expands both promotion rows directly into Sales, one order might now appear twice. Compare the count of order lines before and after the join, then decide whether the data needs a bridge and how promotion reporting should allocate revenue. The correct design depends on whether the same sale can contribute to multiple promotion groups and how totals should behave.

Test regional row-level security with positive and negative cases

Create a North-only static role first and verify that North appears while South disappears in View as. Then design a dynamic role using a mapping from a signed-in user's user principal name to one or more region keys. A security filter on the region dimension can evaluate membership for the current user, with the existing active relationship propagating the allowed regions to Sales. Include a test identity with no mapping and expect no sales rows.

Test a North identity, a South identity, a dual-region identity, and an unmapped identity. Compare row counts and revenue against the fixture, then verify access again with a representative user in the Power BI service. For workspace users, row-level security restricts users with Viewer permissions. Workspace Admins, Members, and Contributors have elevated access, so elevated accounts cannot substitute for a representative Viewer test. Document the role membership alongside the count and amounts you observed.

Make this lab a PL-300 exam readiness check

Close your notes and rebuild the case. Add a single small order with a very high margin, predict the effect on the overall ratio, and check it in the matrix. Add another user mapping and predict every visible region before testing the role. If the measure is correct but the security result is wrong, trace the identity, mapping, and relationship independently of the arithmetic.

Keep the three-row fixture as a reusable regression check. It can show whether a new Power Query merge changed the sales grain, whether a slicer reaches the right table, and whether a model change unexpectedly broadens user access. In your exam review, be able to say which of those failures belongs to data preparation, modeling, or managing and securing Power BI.

KEEP THESE THREE THINGS

Your next steps

  1. Calculate the ratio from totals within the current filter context.
  2. Confirm grain and relationship behavior with known row counts before editing DAX.
  3. Verify dynamic row-level security with mapped and unmapped accounts and a real Viewer test.

Sources & official resources

Linked resources checked on 2026-11-25. Technical behavior and provider guidance can change; check the documentation for the version you use.

About this guide and its recommendations

Published by Prep With Proof with AI-assisted drafting. Study routines and examples are editorial suggestions, not official exam instructions or claims of a learner's personal results. Cited provider facts are linked; ownership of recommended Prep With Proof products is disclosed. No competitor endorsement or guaranteed certification outcome is implied.

Suggest a correction →