So I am doing some cool things to the reports to add flavor. What I have done is added a Greeting to the cover page of the reports so that it displays the USERPRINCIPLENAME() for the logged in individual along with a greeting based on time of day. For my organization, the USERPRINCIPLENAME() is the email address and not the actual name.
Is it possible for me to create a table that has the individuals email address and their display name and some get it to use the display name instead of the USERPRINCIPLENAME()?
So instead of displaying Good Afternoon jmwdba@domain.com it will display Good Afternoon Michael Williams.
This worked like a charm. If anyone else is interesting in applying this unique customization to any of their reports, below are the formulas and steps used.
STEP 1:Create a User table.
In the case of my table, I have a field for the Email (which is also the userprinciplename() for my organization) and I have a column called Display name which is the name I actually want to show.
STEP 2: Create Display name Formula
Display User =
CALCULATE( SELECTEDVALUE(Users[Display Name]),
FILTER(Users, Users[Email]= USERPRINCIPALNAME()))
STEP 3: Create The Greeting
Greeting =
VAR user = [Display User]
VAR hour = HOUR(NOW())
VAR minute = MINUTE(NOW())
VAR prefix = SWITCH(
TRUE(),
hour<12, âGood Morningâ,
hour<17, âGood Afternoonâ,
âGood Dayâ
)
RETURN CONCATENATE(prefix&" ", user)
I also came across the issue where the Message based on time of day was correct on the desktop but when uploaded to the Power BI Service it was wrong. So the the below article helps solve this problem:
I actually used the âEnter Dataâ inside of Power BI I named the table âUsersâ and created the columns âEmailâ, âDisplay Nameâ and âOfficial Nameâ. For my organization our userprinciplename() is our âEmailâ.
In my Display User Formula that is where in the filter you tell it when the User[Email] = userprinciplename() then give the selected value Users[Display Name]. So that is your link between the email address in the Users table and the userprinciplename(). I did when creating the âEmailâ column or really just bring in an existing spreadsheet that has all that information if you have a larger number of users. In my case, I only have 50 users to bring in so it was faster to just type it.
Display User =
CALCULATE( SELECTEDVALUE(Users[Display Name]),
FILTER(Users, Users[Email]= USERPRINCIPALNAME()))