Skip to main content

Power BI

Needs Votes

Provide username function in Power Query - M or DAX calculated columns

Vote (431) Share
's profile image

on 20 May 2016 01:15:53

Being restricted to just using username () in measures (or AllowedRowsExpression) means that you cannot use the context of the current user in slicers or page level or report level filters.

Just to be clear, the desired result is not data security (that can be done through roles), it is to provide relevance. We want to be able to show a page that shows (for example) My Teams timesheet hours, perhaps next to a report page that shows an overview of the entire company.

You can provide some neat filtering using measures containing username () , but in particular, you can’t provide slicers (or page filters) that are cut down to just the list of relevant items based on the user logged in.

It would be extremely helpful if you could access the username value either via a function in PowerQuery M, or to allow username () to be referenced in a calculated column using DAX.
Trying to use username () in a calculated column currently gives the error:

"CUSTOMDATA and USERNAME functions are not supported in calculated columns. These functions may only be used in Measures or in the AllowedRowsExpression."

Perhaps there are security, functional or performance reasons why this isn't possible, but thought it worth putting forward.

Comments (41)
's profile image Profile Picture

Pavlina on 06 Jul 2020 00:01:21

RE: Provide username function in Power Query - M or DAX calculated columns

I would need it also.

's profile image Profile Picture

Justin on 06 Jul 2020 00:01:12

RE: Provide username function in Power Query - M or DAX calculated columns

Functionality please.

's profile image Profile Picture

Power BI User on 06 Jul 2020 00:00:03

RE: Provide username function in Power Query - M or DAX calculated columns

We need to have this feature now. Why is this not in this tool yet?!?!

's profile image Profile Picture

Thiruvengadarajan Chandrasekaran on 05 Jul 2020 23:58:30

RE: Provide username function in Power Query - M or DAX calculated columns

We would recommend this strongly as this would help the community to implement dynamic row level security. Without this, the solution requires us to go for one more layer or other complex solutions which is expensive.

's profile image Profile Picture

Anthony on 05 Jul 2020 23:56:19

RE: Provide username function in Power Query - M or DAX calculated columns

We need this urgently for dynamic RLS!!!

's profile image Profile Picture

Adam S on 05 Jul 2020 23:51:48

RE: Provide username function in Power Query - M or DAX calculated columns

Just another reason why we are seriously starting to consider other BI tools. This is a basic feature that should have been available a long time ago.

's profile image Profile Picture

Matt Urbanowski on 05 Jul 2020 23:51:47

RE: Provide username function in Power Query - M or DAX calculated columns

We need this so we can still display the data (not filter out with RLS), but instead to customize what is displayed for the current user.

's profile image Profile Picture

Daniel Sanders on 05 Jul 2020 23:48:15

RE: Provide username function in Power Query - M or DAX calculated columns

Yes please!

's profile image Profile Picture

Power BI User on 05 Jul 2020 23:46:38

RE: Provide username function in Power Query - M or DAX calculated columns

Must have yesterday

's profile image Profile Picture

Power BI User on 05 Jul 2020 23:39:42

RE: Provide username function in Power Query - M or DAX calculated columns

Adding this feature would really help to improve efficiency of queries and extend Power BI's usage. I don't understand why it is not already available.