cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Jan_Trummel
Helper III
Helper III

Role based on location

Hello to the forum,

 

I have the following table "Sales":

 

The sales come from different regions.The sales come from different regions.

As you can see, sales are generated either in the "North" region or in the "South" region.
But there are people who are only allowed to see sales from either North or South or from both regions.
I recorded these conditions in the “Accounts” table:

 

The "Accounts" table shows who can see sales from which regionsThe "Accounts" table shows who can see sales from which regions

 

The challenge is that the user "Charlie" is allowed to see sales from all regions.

I would like to define a role that, depending on the email address in the "Account" column, only shows the logged-in Power BI user the sales intended for him.

Do you have an idea how I can realize this?

 

Can you help me?

 

Greetings

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Jan_Trummel ,

According to your description,here's my solution. Use Row-level security (RLS) like this:

1.Click Home>Manage roles.

vyanjiangmsft_0-1691747639507.png

2.Add a new role, filter the Account column in Accounts table:

[Account] = USERPRINCIPALNAME()

vyanjiangmsft_1-1691747802931.png

3.Filter the Location column in Sales table:

SWITCH (
    MAXX (
        FILTER ( 'Accounts', 'Accounts'[Account] = USERPRINCIPALNAME () ),
        'Accounts'[Location]
    ),
    "North", [Location] = "North",
    "South", [Location] = "South",
    "ALL", [Location] IN { "South", "North" }
)

vyanjiangmsft_2-1691747900013.png

Get the correct result:

vyanjiangmsft_3-1691747975943.png

vyanjiangmsft_4-1691747988190.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Jan_Trummel
Helper III
Helper III

Thank you @v-yanjiang-msft

 

that is exactly what I wanted!

v-yanjiang-msft
Community Support
Community Support

Hi @Jan_Trummel ,

According to your description,here's my solution. Use Row-level security (RLS) like this:

1.Click Home>Manage roles.

vyanjiangmsft_0-1691747639507.png

2.Add a new role, filter the Account column in Accounts table:

[Account] = USERPRINCIPALNAME()

vyanjiangmsft_1-1691747802931.png

3.Filter the Location column in Sales table:

SWITCH (
    MAXX (
        FILTER ( 'Accounts', 'Accounts'[Account] = USERPRINCIPALNAME () ),
        'Accounts'[Location]
    ),
    "North", [Location] = "North",
    "South", [Location] = "South",
    "ALL", [Location] IN { "South", "North" }
)

vyanjiangmsft_2-1691747900013.png

Get the correct result:

vyanjiangmsft_3-1691747975943.png

vyanjiangmsft_4-1691747988190.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors