PowerBI DAX- USERNAME

This is a function that may not be used as frequently as it used to be but it is likely you will encounter it in older PowerBI Reports where RLS or row level security was implemented. The function returns the username of the user currently viewing the report. Using this information and mapping it against a table with the permission was how we used to Implement RLS. You can still use this function as part of managing roles and accounts.

When created as a measure the result will look similar to the screenshot below

The DAX function can be implemented as a measure as shown below

ExUserName = USERNAME()

It can then be called within a textbox control by changing the title to use a function as shown below

In the pop up simple select based on Field and identify the measure to be used.

The SQL equivalent of the above function is

SELECT SUSER_NAME()

Please Consider Subscribing

Leave a Reply