I am generating Power BI
embedded tokens for Row Level Security.
The token contains a value of a role for the USERNAME()
function to receive, which is then used in the Table filter DAX expression, e.g.: [Region] = USERNAME()
. This works when a value (say West
) is passed in from the token, and the sales report will be filtered by the West
Region.
Next, I need to add additional filters like: [Region] = USERNAME() && [Customer] IN {"Delta", "Echo"}
. I've tried to pass in West|Delta|Echo
to USERNAME() and changed the DAX expression to:
[Region] = LEFT(USERNAME(), FIND("|", USERNAME())-1) && [Customer] IN {"Delta", "Echo"}
This version worked, but the list for IN filter had to be hard-coded.
Is there a way to write a DAX expression to extract multiple values delimited by |
and create a list for the IN
operator shown above?