Kalavryta (Greece)

Adding a Touch of Personalization | Tailoring Your Reports with User Names and Extra Sause to Gain Extra Points

Makis Makrandreou
Microsoft Power BI
Published in
2 min readMay 3, 2024

--

Let’s talk about a cool trick to spice up your reports and make them super personal. Imagine your report not only gives out numbers but also says “Hi” to each person reading it and gives them a message based on the day they’re reading it. Sounds cool, right? Well, with a little magic you can make it happen!

So, here’s the trick: we’re going to use the USERPRINCIPALNAME() in a custom measure. This command helps us know who's looking at the report. It's like saying, "Hey, Report, who's there?" And the report answers with the name of the person.

I used to create a custom measure as the below to say “Hello ‘user’!!!” and gain their attention from the first click.

My_Message_toUser = 
SWITCH(
USERPRINCIPALNAME(),
"m.makrandreou@opap.gr", "Hello Mr Makrandreou <3",
"Jenny@opap.gr", "Hello Jenny",
"G.Georgw@opap.gr", "Nice to see you Georgw",
"BYE"
)

You can make it more catchy if you use time elements too. The below measure displays a different hello, based on the current date for the report user.

My_Daily_HelloUser
=SWITCH(
MONTH(TODAY()),
1, "Happy New Year! Keep rocking, ",
12, "Merry Christmas! Enjoy the holidays, ",
7, "Hey, it's summertime! Stay cool, ",
"Hello! Have a great day, "
) & =USERPRINCIPALNAME() & "!"

Of course you can utilize the USERPRINCIPALNAME() for operational reasons, for example to show to each user specific content.

My_SalesoftheUser
=IFERROR(
SUMIFS(Sales[Amount], Sales[Salesperson], =USERPRINCIPALNAME(), Sales[Date], ">=" & DATE(YEAR(TODAY()), MONTH(TODAY()), 1), Sales[Date], "<=" & TODAY()),
"Sorry, couldn't find your sales data."
)

Combining USERPRINCIPALNAME() with DAX functions like TODAY(), and more similar formulas, allows you to create personalized measures and messages tailored to individual users. Whether it's calculating performance metrics or delivering customized greetings, leveraging these functions enhances the user experience and makes your reports more engaging and relevant.

*USERPRINCIPALNAME() is the login email of the user

Hope that helps!

Don’t forget to subscribe to

👉 Power BI Publication

👉 Power BI Newsletter

and join our Power BI community

👉 Power BI Masterclass

--

--