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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is 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
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.

Top Kudoed Authors