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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

RLS_DAX_ of two disconnected table using wildcard

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
2 REPLIES 2
Fowmy
Super User
Super User

@Anonymous 

Create the following measure for RLS, replace "sourav" with any other name to test. When you deploy after testing, you should replace the  VAR __User = "sourav" with VAR __User = USERPRINCIPALNAME()

RLS User =
VAR __User = "sourav"
VAR __UserAccessFilter =
    FILTER ( user_access, user_access[user name] = __User )
VAR __Fjob =
    SELECTEDVALUE ( main_fact_table[job_no] )
VAR __Fyear =
    SELECTEDVALUE ( main_fact_table[year] )
VAR __Result =
    NOT ISEMPTY (
        FILTER (
            __UserAccessFilter,
            CONTAINSSTRING ( __Fjob, user_access[job_no] )
                && user_access[year] = __Fyear
        )
    )
RETURN
    __Result



Assign the meaure in the RLS setup as follows:

Fowmy_0-1704919345371.png

You may test it this way: Sourav should be able to see three lines not two.

Fowmy_1-1704919391161.png

 


Files is attached.



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thanks for the help, but in my actual data in the fact table many column(more than two) are present and while implementing the DAX and RLS for all users no value is showing for every user the data is showing blank.

could you please tell what went wrong?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.