Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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?
Solved! Go to Solution.
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:
Proud to be a Super User! | |
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
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:
Proud to be a Super User! | |
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
87 | |
86 | |
75 | |
69 | |
66 |
User | Count |
---|---|
216 | |
128 | |
117 | |
82 | |
76 |