Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
Charu
Post Patron
Post Patron

How to display Username with greetings when user log in?

Hi Everyone,

 

Please let me know whether my requirement is possible in power bi service login using RLS(row level Security)

example: When I log in to the report the left side I would like to display My name with greetings.

 

Based on login time Greeting should change like Good morning,Good Afternoon,Good Evening

username greeting.PNG

2 ACCEPTED SOLUTIONS

Greeting1 = 
VAR user = USERNAME()
VAR display = LOOKUPVALUE(Table1[User],Table1[Email],user)
VAR hour = HOUR(NOW())
VAR minute = MINUTE(NOW())
VAR prefix = SWITCH(
                    TRUE(),
                    hour<12,"Good morning ",
                    hour>=12 && hour<17,"Good afternoon ",
                    "Good evening "
             )
RETURN CONCATENATE(prefix,display)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Hi

 

below is how I achieved the Timezone difference, timezone correct.PNGfor your reference

 

View solution in original post

8 REPLIES 8
Greg_Deckler
Super User
Super User

How about a measure in a card visual like this:

 

Greeting = 
VAR user = USERNAME()
VAR hour = HOUR(NOW())
VAR minute = MINUTE(NOW())
VAR prefix = SWITCH(
                    TRUE(),
                    hour<12,"Good morning ",
                    hour<17,"Good afternoon ",
                    "Good evening "
             )
RETURN CONCATENATE(prefix,user)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Wow! Great @Greg_Deckler.Thank you.

 

Username() returning sara@xyz.com instead I need the name only .so I'm maintaining one column to store the list of username in each table. 

 

suppose If I have 3tables connected to the report and each table I will be having UsernameList and Email list

 

how could I pass username list column in the parameter

var User =UsernameList

 

UsernameList is the filed name in my table

 thanks in advance

 

Greeting1 = 
VAR user = USERNAME()
VAR display = LOOKUPVALUE(Table1[User],Table1[Email],user)
VAR hour = HOUR(NOW())
VAR minute = MINUTE(NOW())
VAR prefix = SWITCH(
                    TRUE(),
                    hour<12,"Good morning ",
                    hour>=12 && hour<17,"Good afternoon ",
                    "Good evening "
             )
RETURN CONCATENATE(prefix,display)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thanks a lot, it's working fine in desktop but once i publish to service the time is wrongly showing please help me where I'm doing mistake

 

I published on 7:39pm that is 19:39 instead it's showing 14:06

 

greeting.PNG

Have a look at this blog:

http://radacad.com/solving-dax-time-zone-issue-in-power-bi

 

But, short story is the easiest way will be to just put an offset into your hour calculation to account for your timezone difference between where you are an where Power BI is hosted.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

It's not working with Userprincipal for other user.Their name is mapped with correct email id

Greeting =
VAR user = USERPRINCIPALNAME()
VAR display = LOOKUPVALUE(Detail[Name],Detail[Email Id],user)
VAR hour = HOUR(NOW())
VAR minute = MINUTE(NOW())
VAR prefix = SWITCH(
TRUE(),
hour<12,"Good morning ",
hour>=12 && hour<17,"Good afternoon ",
"Good evening "
)
RETURN CONCATENATE(prefix/*"Welcome. "*/,display)

Hi @shoeb1359

 

If your Detail[Name] lookup values return the username then try using the USERNAME() function instead of USERPRINCIPALNAME()

Hi

 

below is how I achieved the Timezone difference, timezone correct.PNGfor your reference

 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors