Forum Discussion
DAX in RLS to filter one table based on filtered ID in another table
- 2 years ago
Hi Anonymous
As you want to filter Table 3 based on the sales reps' access to accounts in Table 2 using Row-Level Security (RLS), you can use below DAX in your Table 3 filter to check if each AccountID is included in the list of AccountIDs accessible to the current user through Table 2.
Filter Table 3 by Sales Rep Access =
VAR AllowedAccounts =
CALCULATETABLE(
VALUES('Table 2'[AccountID]),
FILTER(
'Table 2',
'Table 2'[SalesRep] = USERNAME() // Assuming SalesRep is the column representing the sales representative's name
)
)
RETURN
FILTER(
'Table 3',
'Table 3'[AccountID] IN AllowedAccounts
)
Then use this DAX as a row level security on table 3 in power BI.
Thanks!
Inogic Professional Service Division
An expert technical extension for your techno-functional business needs
Power Platform/Dynamics 365 CRM
Drop an email at [email protected]
Service: http://www.inogic.com/services/
Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/
Hi Anonymous
As you want to filter Table 3 based on the sales reps' access to accounts in Table 2 using Row-Level Security (RLS), you can use below DAX in your Table 3 filter to check if each AccountID is included in the list of AccountIDs accessible to the current user through Table 2.
Filter Table 3 by Sales Rep Access =
VAR AllowedAccounts =
CALCULATETABLE(
VALUES('Table 2'[AccountID]),
FILTER(
'Table 2',
'Table 2'[SalesRep] = USERNAME() // Assuming SalesRep is the column representing the sales representative's name
)
)
RETURN
FILTER(
'Table 3',
'Table 3'[AccountID] IN AllowedAccounts
)
Then use this DAX as a row level security on table 3 in power BI.
Thanks!
Inogic Professional Service Division
An expert technical extension for your techno-functional business needs
Power Platform/Dynamics 365 CRM
Drop an email at [email protected]
Service: http://www.inogic.com/services/
Power Platform/Dynamics 365 CRM Tips and Tricks: http://www.inogic.com/blog/