Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

undefined

Hi,
I  am facing some issue while implementing the RLS for below fact table.

main_fact_table

job_noyear
IT1232023
IT1234672024
IT2352023
IT23452024
IT3452023
IT3342024
IT36472023
IT36542024
IT65842023
IT65742024

 

user_access

user namejob_noyear
souravIT122023
jeetIT62023
kunalIT62024
souravIT32024
jeetIT22023
kunalIT12024
rupamIT32024
rupamIT62023


as i mentioned there is two table.

1)main_fact_table  (this is the main facr table)
2)user_access  (this is the details of user who has access to the perticuler data)

these two table are disconnected table hence they have no relation between them, and we are using the coloumn "job_no" (user_access) to decide the access for a perticuler user but in the "user_access" table column "job_no" dose not contain the full value we need to implement wildcard here for example in user_access  one user named "sourav" has access to the row  job_no in fact table  whose value starts with  "IT12" AND "IT3" so sourav should she all the rows in "main_fact_table" whose "job_no" starts with "IT12" AND "IT3" and corrosponding year also should take in considaration

in this case sourav should see in "main_fact_table" as below shown

job_no

year
IT1232023
IT3342024




 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create calculated column.

When applying to multiple users, you can replace "sourav" with USERPRINCIPALNAME().

Test =
var _table1=
SUMMARIZE(
    FILTER('user_access','user_access'[user name]="sourav"),
    [job_no],[year])
var _table2=
DISTINCT('main_fact_table'[job_no1])
var _table3=
CROSSJOIN(_table1,_table2)
var _table4=
ADDCOLUMNS(
    _table3,"test",CONTAINSSTRING([job_no1],[job_no]))
var _max=
MAXX(
    FILTER(
       _table4,
        [test]=TRUE()&&[job_no1]=EARLIER('main_fact_table'[job_no1])&&[year]=EARLIER('main_fact_table'[year])),
        [job_no1])
return
IF(
    _max=BLANK(),FALSE(),TRUE())

2. Modeling – Manage roles – Create – [Test].

vyangliumsft_0-1705047152496.png

 

3. Result:

vyangliumsft_1-1705047220016.png

 

 

Best Regards,

Liu Yang

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

3 REPLIES 3
Anonymous
Not applicable

Thanks much appreciated it worked.

Anonymous
Not applicable

Hi  @Anonymous ,

 

Here are the steps you can follow:

1. Create calculated column.

When applying to multiple users, you can replace "sourav" with USERPRINCIPALNAME().

Test =
var _table1=
SUMMARIZE(
    FILTER('user_access','user_access'[user name]="sourav"),
    [job_no],[year])
var _table2=
DISTINCT('main_fact_table'[job_no1])
var _table3=
CROSSJOIN(_table1,_table2)
var _table4=
ADDCOLUMNS(
    _table3,"test",CONTAINSSTRING([job_no1],[job_no]))
var _max=
MAXX(
    FILTER(
       _table4,
        [test]=TRUE()&&[job_no1]=EARLIER('main_fact_table'[job_no1])&&[year]=EARLIER('main_fact_table'[year])),
        [job_no1])
return
IF(
    _max=BLANK(),FALSE(),TRUE())

2. Modeling – Manage roles – Create – [Test].

vyangliumsft_0-1705047152496.png

 

3. Result:

vyangliumsft_1-1705047220016.png

 

 

Best Regards,

Liu Yang

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

Anonymous
Not applicable

showing the follwing error while replacing user hardcoded name to userprincipalname()

error.PNG

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.