Sunday, 9 November 2025

Power BI RLS Error – Data Type Mismatch in Filter Expression

 Hi Folks,
To resolve this - 

Problem:

The error occurred because the RLS filter compared a Text column (Customer Team Code) with a Numeric value (0).

Original filter:

[Customer Code] == "1000000216" && [Customer Code] == 0

This caused the error: “DAX comparison operations do not support comparing values of type Text with values of type Integer.”


After Fix (Solution):

Updated the filter to use consistent data types and correct logic:

[Customer Code] == "1000000216" || [Customer Code] == "0"

  • Both values are treated as text.
  • OR (||) is used instead of AND (&&) because a single value cannot satisfy both conditions.
  • Verified using View as Role and republished to Power BI Service.

Additional Note:

Dynamic RLS using USERPRINCIPALNAME() can fail if email formats differ (case sensitivity or spaces).\ Fix:

TRIM(LOWER([Email])) = TRIM(LOWER(USERPRINCIPALNAME()))

This resolves the issue and ensures proper row-level security.