Forum Discussion
USERNAME() function DAX
- 10 years ago
Not quite sure if this is what you're looking for, but I do something similar using LOOKUPVALUE. Basically I find where USERNAME() matches the Email in the Users table and then filter the Programs table where either the returned Program 1 or Program 2 match. The filters on the Programs table then flow to all the other tables in my model.
Programs
Program
Users
User 1 Email Program 1 Program 2
My RLS set up in the Programs table is:
[Program] = LOOKUPVALUE(Users[Program 1], [Email], USERNAME()) || [Program] = LOOKUPVALUE(Users[Program 2], [Email], USERNAME())
Not quite sure if this is what you're looking for, but I do something similar using LOOKUPVALUE. Basically I find where USERNAME() matches the Email in the Users table and then filter the Programs table where either the returned Program 1 or Program 2 match. The filters on the Programs table then flow to all the other tables in my model.
Programs
Program
Users
User 1 Email Program 1 Program 2
My RLS set up in the Programs table is:
[Program] = LOOKUPVALUE(Users[Program 1], [Email], USERNAME()) || [Program] = LOOKUPVALUE(Users[Program 2], [Email], USERNAME())
Thanks that worked perfectly.