Forum Discussion
Dax - Execute Queries/RLS
Yes — the Execute Queries API supports this directly, and it's the standard way to get RLS-aware DAX results for embedded users who don't have a Power BI account.
The request body takes an 'identities' array alongside your 'queries' array. Each identity object carries a 'username' (any string identifying the end user — it doesn't need to be a real UPN) and a 'roles' array naming the RLS role(s) from your model to apply. That's the same effective-identity mechanism Embedded uses for embed tokens, just passed to Execute Queries instead.
So your body becomes something like { "queries": [...], "identities": [ { "username": "someuser", "roles": ["YourRLSRoleName"] } ] }. The DAX query then runs as if that user were logged in and subject to that role's filter.
One thing worth double-checking: if your RLS rule expressions read USERNAME() vs CUSTOMDATA(), make sure you're populating the matching field on the identity object — username feeds USERNAME()/USERPRINCIPALNAME(), and there's a separate 'customData' property on the identity if your rules use CUSTOMDATA() instead.