Implementing Row-Level Security in Power BI

The best method to implement row-level security in a published Power BI model or SSAS Tabular model consumed from the Power BI service will depend to some degree on your data structure and requirements.  The method I demonstrate here is one of the most flexible approaches and one that I commonly use in my projects.

Paul Turley

Paul Turley

Microsoft Data Platform MVP, Solution Architect for P3 Adaptive Specializing in Microsoft Fabric, Business Intelligence, SQL Server solutions, Power BI, Analysis Services & Reporting Services. Author of Microsoft Power BI Data Analyst Study Guide & 15 other titles.

5 thoughts on “Implementing Row-Level Security in Power BI

  1. Hey Paul,

    Thanks for sharing, it’s very useful the way that you treat BLANK() value.
    Below I share my code DAX that I apply to CRM Dynamic 0365 the idea is :
    1/ you look up for the position (and their business unit ) of the person who log in then you stock the result in a variable.
    Position:
    Sales Rep – only see their own data
    Sales Manager – see the whole team data
    Business Unit:
    Retail
    Salon

    2/ Then depend on the position you show them what they can see using SWITCH():

    //position of UPN
    VAR Position_Rule = LOOKUPVALUE(
    User[Position],
    User[Sales Rep], USERNAME()
    )
    //business unit of UPN
    VAR BU_Rule = LOOKUPVALUE(
    User[Business Unit],
    User[Sales Rep], USERNAME()
    )

    RETURN
    //if the UPN’s postion is

    SWITCH(Position_Rule,

    //Representative : display only their data

    “Sales Representative”,[Sales Rep] = USERNAME(),

    //Sales Manager > display all the data relevant to their team and them self

    “Sales Manager”, ([Sales Manager] = USERNAME() || [Sales Rep] = USERNAME()),

    FALSE()
    )

    Dung Anh

Leave a Reply

Discover more from Paul Turley's SQL Server BI Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading