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

Yash Gupta on 05 Jul 2020 23:38:41

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

Any update on this feature?

's profile image Profile Picture

Jelle on 05 Jul 2020 23:38:41

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

i could also use an update on this feature, would be very usefull

's profile image Profile Picture

Power BI User on 05 Jul 2020 23:37:52

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

to use direct query and composite models effectively I need this feature to pass the user to the database

's profile image Profile Picture

Harira on 05 Jul 2020 23:35:48

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

I urgently need this too!!! What is the status on this feature!

's profile image Profile Picture

John Dawson on 05 Jul 2020 23:32:11

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

Would be useful, otherwise I have to pass in this value as a parameter

's profile image Profile Picture

JB on 05 Jul 2020 23:32:05

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

This idea should have way more votes and attention!

's profile image Profile Picture

Andrea Libby on 05 Jul 2020 23:31:48

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

Have there been any updates on this idea? As other have mentioned below, this is something that is severely needed on my end to get some good filters going. For example: allowing a manager to filter for their direct reports vs their entire organization. Using RLS allows me to give them access to their entire org, but I need to provide away for them to specifically filter for their direct reports.

's profile image Profile Picture

belvoir on 05 Jul 2020 23:23:12

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

Brian is spot on. This restricts the ability to have different types of users seeing different views. As he says, it's possible with measures but slicers use only columns. Passing the username () in Embedded and presenting back a tailored dashboard to the user would be wonderful.
And it'll take Power BI to a new level of flexibility and development potential.

's profile image Profile Picture

Adam S on 05 Jul 2020 23:22:24

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

The ability to use the username in the column is critical for me as well. I need the ability to filter one visual to the current user, I can't use RLS because I am not trying to restrict the data but filter a visual.

's profile image Profile Picture

Praseej on 05 Jul 2020 23:17:41

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

Team, we are stuck on username () , we cannot use it in Report level or Page level until it is in calculated columns, especially Power BI reporting Server. if the functionality is not available within a month we are forced to move our reports to other reporting tools. Hope for a new update soon....