Expression USEREMAIL()

How can I limit the display of some data based on the user’s role? I used an expression in which to filter based on a function, but I need it to be based on 3.

I used this expression: LOOKUP(USEREMAIL(), user, email, function) = “user role”

So I normally create a user table which stores the user name, login email address and role. Then in an app you can use something like to allow only admins & managers to do/see something

OR(
ANY(Select(Usertable[UserRole],[LoginEmail]=UserEmail()))=“Admin”,
ANY(Select(Usertable[UserRole],[LoginEmail]=UserEmail()))=“Manager”
)

1 Like

me returns this error

I adapted the expression and it worked. Thanks

adapted function:

or(
lookup(UserEmail(), user, email, function) = “Admin”,
lookup(UserEmail(), user, email, function) = “Manager” )

Only one table scan instead of two:

ISNOTBLANK(
  FILTER(
    "UserTable",
    AND(
      (USEREMAIL() = [LoginEmail]),
      IN([UserRole], {"Admin", "Manager"})
    )
  )
)
4 Likes