Forum Discussion

tobny76's avatar
tobny76
Helper III
6 months ago
Solved

RLS TeamLevel - Organization L4-6

Background: All started with stakeholders wanted us to add RLS on Level 5 for some people. We created an Azure Security Group and added the persons to that group and created table "TeamAccesSecurit...
  • cengizhanarslan's avatar
    5 months ago

    Step 1) Create one access table

    Build a single table like this:

     
    This table defines who can access which organizational unit at which level.

     

    Step 2) Create a normalized bridge table from your hierarchy

    Today your model probably has columns like:

    • L4 Org Unit ID
    • L5 Org Unit ID
    • L6 Org Unit ID

    Create a new bridge table by unpivoting those columns into this format:

    So each salesperson/entity will have multiple rows, one row per hierarchy level.

     

    Step 3) Keep your base dimension/fact model as is

    Do not try to directly relate one security table to 3 different columns in the same table.

    Instead, keep your existing fact/dimension tables unchanged, and use the new bridge table as the connection point.

    • TeamAccess → security table
    • OrgBridge → normalized hierarchy table
    • Salesperson or Sales Unit → main business table
    • Fact → sales/fact table

     

    Step 4) Create relationships

    Then let the filter flow from:

    • TeamAccess → OrgBridge → Salesperson/Org table → Fact

    Power BI cannot relate on two columns directly, so create a combined key such as:

    • LevelOrgKey = [Level] & "|" & FORMAT([OrgUnitID], "") 

     

    Step 5) Add the RLS rule only on the access table

    Apply RLS on TeamAccess only:

    • LOWER(TeamAccess[Email]) = LOWER(USERPRINCIPALNAME())