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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PedroFarias
Frequent Visitor

RLS problems with Direct Query

Hi folks,

I have a report that had a table connection recently changed to Direct Query, since then some of my RLS functions are not working as they should and I keep getting the "CONTAINSROW is not allowed on Direct Query". But here is the catch, I don't have any RLS functions that use CONTAINSROW nor anything similar to it, what I do have is something similar to:


[VENDOR] == "Vendor 1"

With that, I assign the Vendor to its function, and it usually works, but since the change some of the users are receiving the error that I mentioned. Does anyone know what can be the error?

Here is the list os the things that I already tried:

  • Assigned some new users to the same function, the new users do not receive the same error.

  • Tried to clear the cache for the users with error but had no effect.

  • Asked a user to connect using my machine, also no effect.



The only difference between these users is that the users receiving the error are using the "Premium per User" license, and the ones that do not receive the error use the "Pro" license,  but I also tried to swap their licenses and had no effect.

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @PedroFarias  - The issue you're experiencing with CONTAINSROW and Direct Query after switching the connection mode, despite not explicitly using the function in your RLS (Row-Level Security), is likely caused by an indirect relationship between how Power BI interprets your RLS expressions and the limitations of Direct Query.

 

If [VENDOR] is coming from a related table (e.g., via a one-to-many or many-to-many relationship), ensure that the relationship is working as expected and does not introduce ambiguity.
For Direct Query, avoid bi-directional relationships or relationships involving calculated columns.

 

alternative:

If possible, switch back to Import mode, as it’s more forgiving with RLS and DAX expressions.
Implement RLS in the Source:

For Direct Query, consider implementing RLS directly in the source system (e.g., SQL Server, Azure SQL) to avoid Power BI limitations.
Split the Dataset:

Use a hybrid approach where only high-velocity data resides in Direct Query and other data is in Import mode. This can reduce the complexity of DAX expressions.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Poojara_D12
Super User
Super User

Hi  @PedroFarias 

The "CONTAINSROW is not allowed on DirectQuery" error might be related to licensing differences between Premium Per User (PPU) and Pro licenses, as PPU users can face limitations with DirectQuery and RLS. Even though you're not using CONTAINSROW explicitly, Power BI might be generating queries that trigger unsupported operations in DirectQuery mode.

To fix the issue:

  1. Test with Pro users to see if the error persists (PPU may have limitations).
  2. Simplify your RLS logic to avoid complex DAX functions.
  3. Ensure dataset refreshes are successful and RLS is correctly applied.
  4. Check if there are issues with the DirectQuery connection settings or data model.

    If it still doesn't work, consider contacting Microsoft support for further troubleshooting.

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

View solution in original post

6 REPLIES 6
v-saisrao-msft
Community Support
Community Support

Hi @PedroFarias,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

 

v-saisrao-msft
Community Support
Community Support

Hi @PedroFarias,

Thanks for reaching out to the Microsoft forum community.

 

Could you please confirm if your query have been resolved? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

 

Thank you.

Poojara_D12
Super User
Super User

Hi  @PedroFarias 

The "CONTAINSROW is not allowed on DirectQuery" error might be related to licensing differences between Premium Per User (PPU) and Pro licenses, as PPU users can face limitations with DirectQuery and RLS. Even though you're not using CONTAINSROW explicitly, Power BI might be generating queries that trigger unsupported operations in DirectQuery mode.

To fix the issue:

  1. Test with Pro users to see if the error persists (PPU may have limitations).
  2. Simplify your RLS logic to avoid complex DAX functions.
  3. Ensure dataset refreshes are successful and RLS is correctly applied.
  4. Check if there are issues with the DirectQuery connection settings or data model.

    If it still doesn't work, consider contacting Microsoft support for further troubleshooting.

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
v-saisrao-msft
Community Support
Community Support

Hi @PedroFarias,

 

Thanks for reaching out to Microsoft forum community.

 

In addition to the helpful response provided by @rajendraongole1 , could you please confirm if your query have been resolved? If so, please accept it as a solution and leave a "Kudos" so other members can find it more easily.


Thank you.

SaiTejaTalasila
Super User
Super User

Hi @PedroFarias ,

 

RLS applies to only viewer role it won't apply to any other roles.

Or you can remove RLS and try to test for the users it might give some more details.

 

Thanks,

Sai Teja 

rajendraongole1
Super User
Super User

Hi @PedroFarias  - The issue you're experiencing with CONTAINSROW and Direct Query after switching the connection mode, despite not explicitly using the function in your RLS (Row-Level Security), is likely caused by an indirect relationship between how Power BI interprets your RLS expressions and the limitations of Direct Query.

 

If [VENDOR] is coming from a related table (e.g., via a one-to-many or many-to-many relationship), ensure that the relationship is working as expected and does not introduce ambiguity.
For Direct Query, avoid bi-directional relationships or relationships involving calculated columns.

 

alternative:

If possible, switch back to Import mode, as it’s more forgiving with RLS and DAX expressions.
Implement RLS in the Source:

For Direct Query, consider implementing RLS directly in the source system (e.g., SQL Server, Azure SQL) to avoid Power BI limitations.
Split the Dataset:

Use a hybrid approach where only high-velocity data resides in Direct Query and other data is in Import mode. This can reduce the complexity of DAX expressions.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.