I am applying dynamic security to a SQL Server Tabular model in an education environment. I have a security table with userid's and the associated school that the user should have access to. My DAX filter works fine if a user has one school, but I get a multi-value error ("A table of multiple values was supplied where a single value was expected.") for users that have more than one school. My LOOKUPVALUE()
function is causing the problem, and I'm basically trying to determine how I can create a loop to compare Enrollment[SchoolKey]
against each SecurityTable[SchoolKey]
value for each user. Any thoughts are much appreciated!
=
CONTAINS (
'Enrollment',
'Enrollment'[StudentKey], Student[StudentKey],
'Enrollment'[SchoolKey], LOOKUPVALUE (
SecurityTable[SchoolKey],
SecurityTable[UserId], USERNAME ()
)
)