How can we improve Power BI?

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

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.

259 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

Brian Mather shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • Anonymous commented  ·   ·  Flag as inappropriate

    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.

  • Jelle commented  ·   ·  Flag as inappropriate

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

  • Anonymous commented  ·   ·  Flag as inappropriate

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

  • Harira commented  ·   ·  Flag as inappropriate

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

  • JB commented  ·   ·  Flag as inappropriate

    This idea should have way more votes and attention!

  • Andrea Libby commented  ·   ·  Flag as inappropriate

    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.

  • belvoir commented  ·   ·  Flag as inappropriate

    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.

  • Adam S commented  ·   ·  Flag as inappropriate

    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.

  • Praseej commented  ·   ·  Flag as inappropriate

    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....

  • Anonymous commented  ·   ·  Flag as inappropriate

    Team, any updates for using current username in calculated column. This is a critical functionality in implementing Row level security dynamically.

  • Arpit commented  ·   ·  Flag as inappropriate

    Any updates for using the current Username() in calculated column it is very important functionality for using Row Level Security dynamically.

  • ksabi commented  ·   ·  Flag as inappropriate

    This function would be a great improuvement of dax. any news for this idea?

  • Lyle Spencer commented  ·   ·  Flag as inappropriate

    Also, the comments below do not address what Brian is trying to do. Power BI RLS is post query, not at query time. Also the solution offered by anonymous to "=Sql.Database("(localdb)\v11.0","",[Query="SELECT SYSTEM_USER"])
    should do it" will not work as most queries, particularly if going through a gateway will have the service account context not the user running the report.

← Previous 1

Feedback and Knowledge Base

Ready to get started?

Try new features of Power BI today by signing up and learn more about our powerful suite of apps.