Forum Discussion
show RLS Role name Currently being viewed on each sheet
- 1 year ago
Hi Anonymous , sorry to know it didn't work for you. Please try below:
ActiveRole =
VAR CurrentRole = USERNAME()
RETURN
SWITCH(
CurrentRole,
"John", "John",
"Jim", "Jim",
"Bill", "Bill",
"No Role Assigned"
)If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi Anonymous , Thank you for reaching out to the Microsoft Community Forum.
Please try below DAX measure to display the current role based on your static Row-Level Security (RLS) setup. It also accounts for overlapping values like "John/Jim", handles blank or unexpected cases.
ActiveRole =
VAR SelectedManager = SELECTEDVALUE('YourTableName'[Manager], BLANK())
RETURN
SWITCH(
TRUE(),
ISBLANK(SelectedManager), "No Role Assigned",
SelectedManager = "Bill", "Bill",
SelectedManager IN {"John", "John/Jim"}, "John",
SelectedManager IN {"Jim", "John/Jim"}, "Jim",
"Unknown Role"
)
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
v-hashadapu thank you, this doesnt work the way I need it , as shown below I get no role assigned when I view as a manager that has multiple names that roll up to one manager. When a manager has only one name it works just fine.
- v-hashadapu1 year ago
Community Support
Hi Anonymous , sorry to know it didn't work for you. Please try below:
ActiveRole =
VAR CurrentRole = USERNAME()
RETURN
SWITCH(
CurrentRole,
"John", "John",
"Jim", "Jim",
"Bill", "Bill",
"No Role Assigned"
)If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.