Forum Discussion
Show current user Department
- 2 years ago
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 _deptYou can then add the measure to a card, or insert it into a textbox like below:
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: