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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
inavedk
Frequent Visitor

Dynamic RLS With Multiple Columns in User Table

I am trying to create a dynamic rls , Here is my RLS code

VAR _RLS_Restriction =
IF (
_Roles IN "Region" && [WH_Region] IN _AllowedRegions,
TRUE(),
IF (
_Roles IN "Project" && [WH_Project] IN _AllowedProjects,
TRUE(),
IF (
_Roles IN "Group" && [Agent_Group_Name] IN _AllowedGroups,
TRUE(),
IF (
_Roles IN "Region-Project" && [WH_Region] IN _AllowedRegions && [WH_Project] IN _AllowedProjects,
TRUE(),
IF (
_Roles IN "Region-Group" && [WH_Region] IN _AllowedRegions && [Agent_Group_Name] IN _AllowedGroups,
TRUE(),
IF (
_Roles IN "Project-Group" && [WH_Project] IN _AllowedProjects && [Agent_Group_Name] IN _AllowedGroups,
TRUE(),
IF (
_Roles IN "Region-Project-Group" && [WH_Region] IN _AllowedRegions && [WH_Project] IN _AllowedProjects && [Agent_Group_Name] IN _AllowedGroups,
TRUE(),
FALSE()
)
)
)
)
)
)
)

RETURN
_RLS_Restriction

 

 

 

Also Role column i have created with this dax

 

Role =
VAR regionname = [Region]
VAR Project = [Project]
VAR _group = [Group]

VAR _Role =
SWITCH(
TRUE(),
regionname <> BLANK() && Project = BLANK() && _group = BLANK(), "Region",
regionname = BLANK() && Project <> BLANK() && _group = BLANK(), "Project",
regionname = BLANK() && Project = BLANK() && _group <> BLANK(), "Group",
regionname <> BLANK() && Project <> BLANK() && _group = BLANK(), "Region-Project",
regionname <> BLANK() && Project = BLANK() && _group <> BLANK(), "Region-Group",
regionname = BLANK() && Project <> BLANK() && _group <> BLANK(), "Project-Group",
regionname <> BLANK() && Project <> BLANK() && _group <> BLANK(), "Region-Project-Group",
"Other"
)
RETURN
_Role

 

 

 

When a user has a single value passed from a range (i.e., a value in any of the three columns and the rest two columns are blank). The RLS works in this case. However, if I want to add a region or project for that user, it gives an error.

The error message I'm receiving is "The function expects a table instead of a string or numeric expression." Or sometimes if i change some context it was saying multiple values supplied where single value was expected.

Any help or insights on how to resolve this would be greatly appreciated. Thank you!

 

Here is the user table 

 

EmnihRegionPrLjecHGroupRole
[email protected]NETHERLANDSNLneNoneGroup
[email protected]NETHERLANDSNLneNoneGroup
[email protected]NETHERLANDSNLneNoneGroup
[email protected]NETHERLANDSNLneNoneGroup
[email protected]NETHERLANDSNLneNoneGroup
[email protected]NETHERLANDSNLneNoneGroup
[email protected]NETHERLANDSNLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]FRANCENLneNoneGroup
[email protected]NoneVGRICV - MLNHCEVUNoneGroup
[email protected]NoneVGRICV PRLJECH SHIELG - MLNHCEVUNoneGroup
[email protected]NoneVLVNNoneGroup
[email protected]NoneGLCHLLIB - VIHRéNoneGroup
[email protected]NoneGLCHLLIB PRL - VIHRéNoneGroup
[email protected]NoneGLCHLLIBNoneGroup
[email protected]NoneEGF - CLMPIÈGNENoneGroup
[email protected]NoneEGF - CLMPIèGNENoneGroup
[email protected]NoneEGF CLMPIèGNENoneGroup
[email protected]NoneFGJ CCRV - CLMPIèGNENoneGroup
[email protected]NoneFGJ CCSC - CLMPIèGNENoneGroup
[email protected]NoneFGJ CCSC VIP - CLMPIèGNENoneGroup
[email protected]NoneHISCLX - CLMPIèGNENoneGroup
[email protected]NoneINHERIVLE - MLNHCEVUNoneGroup
[email protected]NoneLMG - CHVLLNNoneGroup
[email protected]NoneMVVF - FLNHENVYNoneGroup
[email protected]NoneVGRICV - MLNHCEVUNoneGroup
[email protected]NoneVGRICV PRLJECH SHIELG - MLNHCEVUNoneGroup
[email protected]NoneVLVNNoneGroup
[email protected]NoneGLCHLLIB - VIHRéNoneGroup
[email protected]NoneGLCHLLIB PRL - VIHRéNoneGroup
[email protected]NoneGLCHLLIBNoneGroup
[email protected]NoneEGF - CLMPIÈGNENoneGroup
[email protected]NoneEGF - CLMPIèGNENoneGroup
[email protected]NoneEGF CLMPIèGNENoneGroup
[email protected]NoneFGJ CCRV - CLMPIèGNENoneGroup
[email protected]NoneFGJ CCSC - CLMPIèGNENoneGroup
[email protected]NoneFGJ CCSC VIP - CLMPIèGNENoneGroup
[email protected]NoneHISCLX - CLMPIèGNENoneGroup
[email protected]NoneINHERIVLE - MLNHCEVUNoneGroup
[email protected]NoneLMG - CHVLLNNoneGroup
[email protected]NoneMVVF - FLNHENVYNoneGroup
0 REPLIES 0

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.