10

Now do it in Power BI Desktop

Share and secure: Power BI Desktop exercise

Set up row-level security in your model and test it with View as. You practised this in the browser; now do it in your own copy of Power BI Desktop (free from Microsoft), on the same data, and check your numbers below.

1. Get the data

In Power BI Desktop: Home → Get data → Text/CSV, pick each file, then Load. Check that numbers came in as numbers and dates as dates (Table view, column header icons).

In Model view, check or create these relationships (many side first):

  • financials[Country] > Countries[Country]

2. The tasks

  1. 1. A role for Europe

    Modeling → Manage roles → create Europe with the filter [Region] = "Europe" on Countries. Use View as → Europe. What does Total Sales show?

  2. 2. A role for the Americas

    Do the same for Americas and test it.

  3. 3. Publish

    Publish to a workspace in the Power BI service (a free trial works), and assign yourself to a role under the semantic model's Security settings.

3. Check your numbers

Try every task first. Then open each answer: the numbers below come from the same data, so yours should match exactly.

1. A role for Europe
Europe View = CALCULATE(SUM(financials[Sales]), Countries[Region] = "Europe")

Result: 47,859,513.11

2. A role for the Americas
Americas View = CALCULATE(SUM(financials[Sales]), Countries[Region] = "Americas")

Result: 70,866,837.15

3. Publish
  • File → Publish → pick a workspace.
  • Service: semantic model → … → Security → add a member to the role.

The lessons behind this exercise