Forum Discussion
RLS/Dynamic Filter Help needed
- 2 years ago
You don't have the two table connected together do you? There is no need for a relationship between the two tables. That is the only thing I can think of that might cause the problem.
You don't need to have Table1 linked to Table2. Table1 is there just to get the employee and what region they can see. You use that information to filter Table2.
Create a role with a filter on Table2 like this.
VAR _UPN = USERPRINCIPALNAME()
RETURN Table2[LOCATION] = LOOKUPVALUE(Table1[LOCATION],Table1[EMAIL],_UPN)
USERPRINCIPALNAME() gets the account of the person that is logged in. The model uses that to get the region that user can see and apply the filter to Table2.
I have attached my sample file for you to look at.
jdbuchanan71
Thank you for the reply 🙂
And here we go on the merrygoround of DAX lol
What i forgot to show in my example due to brain haze is that I need to granulate the data return further on Watch.
My example data didn't show that (Location can have 4-6 watches)
If i add an email address for the another user and check Employees
This also only shows the individual data of who is logged in not all the people at that location.
My real expression
VAR _UPN = USERPRINCIPALNAME()
RETURN
SA[location]
=
LOOKUPVALUE(
WMFSED[JOB_LOCATION],
WMFSED[WORK_EMAIL]
,_UPN)
WMFSED = Table 1
SA =Table2
Again I do appreciate the help on this
Gary