Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have a table that has the username, name among other information, I want to get the username from the pbi and cross it with this table and return the other information of this user
I want to cross Username with Login_AD and return First_Name_AD
Solved! Go to Solution.
Hi @edumach
As I mentioned before, UserName() will return Domain\Name in Power BI Desktop. UserPrincipalName() will return email format like UserA@xxx.com in Power BI Desktop.
Both of UserName() and UserPrincipalName() will return email format to show UPN(Current user login in Power BI Service) in Power BI Service.
My Test:
CurrentName = CALCULATE(MAX('Table'[Name]),FILTER('Table','Table'[Domain\Name] = [CurrentUser]))
In Desktop, UserName() will return Domain\Name, so measure works well.
In Service, UserName() will return a email format and measure won't work.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @edumach ,
I think you can use Row-Level-Security to restrict data access for given users. Your end user could only see values belong to them after you set RLS in Power BI. What does [Username] looks like, only name or email format? We will use UserName() or UserPrincipalName() Function to get Login_AD.
UserName() will return Domain\Name in Power BI Desktop. UserPrincipalName() will return email format like UserA@xxx.com. Both of them will return email format in Power BI Service. So here I suggest you to use UserPrincipalName(). And you need a Email format column in your table.
My Sample:
Manage role in Desktop:
Test Result:
You need to add the user in Role in Security in Dataset after you publish this report to Power BI Service.
For reference:
Note: Workspace members assigned Admin, Member, or Contributor have edit permission for the dataset and, therefore, RLS doesn’t apply to them.
Here is a blog about dynamic RLS in power bi.
Dynamic Row Level Security with Power BI Made Simple Posted on July 4, 2016
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous I understand your example, but I believe I have not been clear on my problem, what I need is to take the username function that returns the pbi user in domain\user format and look for that user in another table and return the full name.
Hi @edumach
As I mentioned before, UserName() will return Domain\Name in Power BI Desktop. UserPrincipalName() will return email format like UserA@xxx.com in Power BI Desktop.
Both of UserName() and UserPrincipalName() will return email format to show UPN(Current user login in Power BI Service) in Power BI Service.
My Test:
CurrentName = CALCULATE(MAX('Table'[Name]),FILTER('Table','Table'[Domain\Name] = [CurrentUser]))
In Desktop, UserName() will return Domain\Name, so measure works well.
In Service, UserName() will return a email format and measure won't work.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous Excellent, this solution worked perfectly.
as @Anonymous was pointing out you won't get that in the Power BI service. The service "only" gives you the email address. You need to base your lookups on that.
please provide more details. What have you tried and where are you stuck?
Get the usurname from the powerbi session and look it up in the table user and return the name.
User | Count |
---|---|
10 | |
5 | |
4 | |
4 | |
3 |
User | Count |
---|---|
14 | |
9 | |
5 | |
5 | |
4 |