Forum Discussion

PedroFarias's avatar
PedroFarias
Frequent Visitor
1 year ago
Solved

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 no...
  • rajendraongole1's avatar
    1 year ago

    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.

  • Poojara_D12's avatar
    1 year ago

    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.