Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi all,
Unfortunately, I got a very ununsal requirement for Access Control
I have upload the demo power bi file for better explanation.
We get Sales table, region/ country mapping table and user access control table.
The key pain point: User access control by Region first, then by Country.
We cannot hard code the country for each user as many countries in each region and country code can change over the time (I only include a few in demo).
“All” mean user can view all country data for that region.
ie: Eric can view all DACH, NL data, but Sam can only view FRANCE in FRANCE/ BELGIUM.
Name | Region | Country | |
Eric | Eric@abc.com | DACH, NL | All |
Peter | Peter@abc.com | DACH, NL | AUSTRIA |
Boris | Boris@abc.com | DACH, NL | GERMANY |
Peter | Peter@abc.com | FRANCE/BELGIUM | All |
Sam | Sam@abc.com | FRANCE/BELGIUM | FRANCE |
Henry | Henry@abc.com | UK | All |
Peter | Peter@abc.com | UK | All |
How can I achieve 2 layers RLS with user email? I try to use the Organizational Hierarchy concept, but fail.
https://www.dropbox.com/s/7wopvrhs7jgti6g/Hierarchy%20RLS-demo.pbix?dl=0
Thanks.
Hi @Anonymous ,
I have created the role in your sample by the formula.
VAR Email = "Eric@abc.com"
VAR Region =
CALCULATETABLE (
VALUES ( 'User Right'[Region] ),
FILTER ( 'User Right', 'User Right'[Email] = Email )
)
VAR Country =
CALCULATETABLE (
VALUES ( 'User Right'[Country] ),
FILTER ( 'User Right', 'User Right'[Region] IN Region )
)
VAR k =
FILTER ( 'Region/County', 'Region/County'[Region] IN Region )
VAR n =
CALCULATETABLE (
VALUES ( 'Region/County'[Country] ),
FILTER ( 'Region/County', 'Region/County'[Country] IN Country ),
KEEPFILTERS ( k )
)
RETURN
[Country] IN n
You can change the email address to USERNAME function in your side.
BYW, pbix as attached.
Thanks for your reply.
Unfortunately, the problem is more complicated as my team would like to simplify the user control table and also apply All in Region.
Below is my new user control table (All in both Region & Country) and a new table to store all Regions values.
To make it easy, I create a extra step to match for mapping regions first, but I cannot modify the M code successfully (i cannot let All to expand all Regions in my Region table)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
117 | |
84 | |
49 | |
38 | |
28 |
User | Count |
---|---|
188 | |
76 | |
73 | |
54 | |
42 |