How to Configure Entity-Based User Filtering Using Data Relationships
Overveiw
Entity relationship-based filtering allows you to automatically restrict dashboard data based on the currently signed-in user. This approach is useful when users should only view data related to their assigned branch, department, tenant, or other business entity.
In this example, a filter applied to the Users table automatically restricts records returned from the related mapping, entity, and transactional tables through configured relationships.
Prerequisites
Before configuring entity-based filtering:
* Ensure users are created in Bold BI.
* Ensure entity information exists in the datasource.
* Ensure table relationships are properly configured.
* Ensure the user email stored in the datasource matches the authenticated user’s email address.
* Configure the required user attribute or parameter and verify it is available in datasource filters before applying user-based filtering.
Note: For instructions on creating user attributes, refer to the related custom attribute documentation.
Example Data Model:
Users
| UserId | |
|---|---|
| 1 | [email protected] |
| 2 | [email protected] |
UserBranchMapping
| UserId | BranchId |
|---|---|
| 1 | 101 |
| 2 | 102 |
Branches
| BranchId | BranchName |
|---|---|
| 101 | Nairobi |
| 102 | Kisumu |
1: Configure Table Relationships
- Navigate to Data Sources and open the required data source.
- Add the required tables:
- Users
- UserBranchMapping
- Branches
- Fact or Transaction table
- Configure relationships between the tables using the corresponding key columns.
- Verify that the Data Preview returns records from all related tables.
2: Configure the Filter
- Open Filters in the data source.
- Add a new filter on the Email column from the Users table.
- Configure the filter according to your implementation.
Example:
| Property | Value |
|---|---|
| Field | |
| Operator | Inclusion |
| Source | Custom |
| Value | [email protected] |
- Click Apply.
- Click Apply Filters to save the filter.
- Save the data source.
Note: The selected email value can be replaced by a user attribute or parameter that resolves dynamically based on the authenticated user.
How It Works
- The filter is first applied to the Users table.
- Because the Users, UserBranchMapping, Branches, and Sales tables are connected through relationships, the filter propagates across the related tables and automatically restricts the returned records.
- As a result, only records associated with the selected user and corresponding entity are returned.
Expected Result
- For example, when filtering for [email protected], only records related to BranchId 102 are returned.
| UserId | BranchId | SalesAmount | |
|---|---|---|---|
| 2 | [email protected] | 102 | 1500 |
| 2 | [email protected] | 102 | 3200 |
- Data belonging to other users and entities is automatically excluded through the configured relationships.