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
Kanth
Frequent Visitor

RLS with Direct Query

Hello All,

We are migrating from import mode to direct query mode and would like to implement the same RLS we have in import mode. Unfortunately, our RLS uses LOOKUPVALUE function which is not supported in direct query. Here is our current RLS expression.

[V] = LOOKUPVALUE(
           'Sec'[V],
           'Sec'[User],USERPRINCIPALNAME(),
       'Sec'[V],'DIM'[V]
         )
||
[PC] = LOOKUPVALUE(
           'Sec'[PC],
           'Sec'[User],USERPRINCIPALNAME(),
       'Sec'[PC],'DIM'[PC])
 
Single user can have multiple V's or PC's. I have tried multiple things but it is not working as expected. Could you please help me with this?
9 REPLIES 9
Anonymous
Not applicable

Hi @Kanth ,

 

Your expression looks great, does your user have permission above view causing the RLS to not work?

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

This expression works fine with import mode but due to some limitations LOOKUPVALUE function wont work in direct query mode.

lbendlin
Super User
Super User

What made you choose LOOKUPVALUE? Why not TREATAS or the data model?

I have to filter based on two different columns and need to have two relationships instead of using USERELATIONSHIP and all I opted LOOKUPVALUE. I am not faimilar with TREATAS function. Does it work in direct query? If so, could you please let me know how can I achieve my requirement

Looks like TREATAS function is also not allowed in direct query mode.

Looks like TREATAS function is also not allowed in direct query mode.

Do you have a link to a document that states that?

aj1973
Community Champion
Community Champion

Hi @Kanth 

Try

Lookup Measure = 

CALCULATE(

    MAX('Table'[ResultColumn]),

    FILTER(

        ALL('Table'),

        'Table'[SearchColumn] = SELECTEDVALUE('CurrentTable'[SearchColumn])

 

  )

)

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Kanth
Frequent Visitor

This will only work when I have only one value for a user. But, I have more than one value for a single user.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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