Security Filter by Company

Hi, I’m trying to do a security filter that allows a user of a certain company to view information pertaining only to that company. I have a Company table that lists all the companies and then a User table that lists the names and email addresses of all users and the ID of the company they belong to. Could someone please help with an expression for how to set the filter? Or anything else that needs to be done for this to work?

Something like:
LOOKUP(USEREMAIL(), UserTable, USER_EMAIL, CompanyID)=[CompanyID]

3 Likes

@Peter_S1 Another approach would be the horizontal technique described in this article…

It means that first you filter the Users table with USEREMAIL()=[Email]. When that is done, you can filter the table like IN([Company],Users[Company])

2 Likes

Thanks, Aleksi. Is this something that would for for a many to many relationship?
Meaning that a company can have many users, and I want all users of that company to be able to see information for that company only.

A user could also own more than one company/entity. Is there a way to do this where more than one user has access to more than one company?