Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sumanth327
Frequent Visitor

Show current user Department

Hi,

I am new to Power Bi. I would like to show the current user Department from Azure or Office 365 on a text box in one of my Power BI report.
Can you please guide me on this?

 

 

 

 

1 ACCEPTED SOLUTION
dk_dk
Super User
Super User

Hi @Sumanth327 

You can use USERPRINCIPALNAME() in a DAX measure to get the current user account, and if you have access to a dataset that contains users and departments you can use LOOKUPVALUE() to find the department and display that.

Here is the DAX code for the measure, where the user_dept table contains a column for the user email, and the department:

 

Current User Department = 

VAR _user = USERPRINCIPALNAME()
VAR _dept = LOOKUPVALUE(user_dept[department],user_dept[user],_user)

RETURN
_dept

 

 

 

 

 

You can then add the measure to a card, or insert it into a textbox like below:

dk_dk_0-1715691777840.png

 






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
Sumanth327
Frequent Visitor

Dear @dk_dk , I am able to get the Dept using the contact Object from Active Directory and using the formula you have mentioned. Thank you

dk_dk
Super User
Super User

Hi @Sumanth327 

You can use USERPRINCIPALNAME() in a DAX measure to get the current user account, and if you have access to a dataset that contains users and departments you can use LOOKUPVALUE() to find the department and display that.

Here is the DAX code for the measure, where the user_dept table contains a column for the user email, and the department:

 

Current User Department = 

VAR _user = USERPRINCIPALNAME()
VAR _dept = LOOKUPVALUE(user_dept[department],user_dept[user],_user)

RETURN
_dept

 

 

 

 

 

You can then add the measure to a card, or insert it into a textbox like below:

dk_dk_0-1715691777840.png

 






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.