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.
Donal McCarthy commented
Does anyone know if this is even being considered?
Nice to get some acknowledgement of an idea with 340 votes...
ismael oltra commented
I found a way to implement this using a Bridge table. Here is the article on how to do it.
ismael oltra commented
I have been trying to do this in powerbi, and I tried all sort of tricks , without success, and it seems like powerbi does not allow to mask certain information depending on the user that is connecting to the report.
John Reilly commented
Customers don't understand why this is not possible as it is a very common desired use case.
It's insane that this feature isn't available... We've been trying to migrate from tableau to Powerbi, but without the ability to mask (NOT HIDE) data for GDPR compliance, we may need to go back
I too would need this feature, please.
With kind regards,
I would need it also.
We need to have this feature now. Why is this not in this tool yet?!?!
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.
We need this urgently for dynamic RLS!!!
Adam S commented
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.
Matt Urbanowski commented
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.
Must have yesterday
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.
i could also use an update on this feature, would be very usefull
Yash Gupta commented
Any update on this feature?
to use direct query and composite models effectively I need this feature to pass the user to the database
I urgently need this too!!! What is the status on this feature!