- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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! | |
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Microsoft Fabric Community Conference 2025
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
Subject | Author | Posted | |
---|---|---|---|
05-08-2024 05:28 AM | |||
07-29-2024 12:52 PM | |||
Anonymous
| 02-27-2024 11:40 AM | ||
09-21-2023 11:51 PM | |||
05-14-2024 12:36 AM |
User | Count |
---|---|
126 | |
80 | |
59 | |
57 | |
43 |
User | Count |
---|---|
183 | |
111 | |
82 | |
65 | |
50 |