Skip to main content

Power BI

Needs Votes

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

Vote (365) 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 (40)
's profile image Profile Picture

6f3dced1 aa3f-4dfd-9ba7-a572ed0086bc 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

e2f0517a 27f3-430e-8f3d-3be9ce9ca4db 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

63d8816e 4216-48da-9029-07b448db3137 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

f14f740e 0140-4dde-9b17-3a3b4f0ea1d0 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

051a94ff 3eea-4a19-a462-bdffd94c221c 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

55c6d044 be33-498c-bdae-12278f22ed1d 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

7c146cc6 f012-48bd-b5af-26df91087111 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

a3998d99 1562-47db-8aa2-3888bc34ce78 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

0847e48f 45a5-4643-a4f9-3a16011e2559 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.

's profile image Profile Picture

b0714b65 1efb-4dcb-828e-935210f5c064 on 05 Jul 2020 23:38:41

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

Any update on this feature?