Forum Discussion
Need help on multi tenancy
Hi AjithPrasath,
Here’s a suggested approach:
1. Create a Combined Data Model. Instead of keeping each customer’s data in separate datasets, you can combine the datasets into a single model by adding a dimension table that includes a list of companies and their associated data. This table will act as a reference for filtering the data based on the logged-in user.
-Dimension Tables:
- Create a dimension table that lists all the companies.
- User Dimension: Create a dimension table that lists users and their associated companies.
Establish relationships between your company dimension, user dimension, and your data tables. This will ensure that each dataset is properly linked to the respective company and user. and then define Roles for Row-Level Security. You can use functions like `USERNAME()` or `USERPRINCIPALNAME()` to identify the current user. (you might create a role with a DAX filter like: [CompanyID] = LOOKUPVALUE('UserDimension'[CompanyID], 'UserDimension'[Username], USERNAME()) ).
This filter will ensure that users only see data corresponding to their associated company.
If this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.