skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Overview
    • Find consulting services
    • Partner showcase
    • Find a partner
    • Become a partner
    • Instructor-led training
    • Getting started
      • Overview
      • Online workshops
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • Quick Measures Gallery
    • Greeting

    Greeting

    04-05-2018 06:44 AM - last edited 06-26-2018 09:52 AM

    Super User Greg_Deckler
    Super User
    3501 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Greg_Deckler
    Super User Greg_Deckler
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Greeting

    ‎04-05-2018 06:44 AM

    Create a personalized greeting for your users with this Quick Measure. Uses USERNAME function so that doesn't work so well with Publish To Web.

     

    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)

    Place this measure in a Card visualization.

     

    If you have a lookup table of user names and friendly display names, you can do this:

     

     

    Greeting1 = 
    VAR user = USERNAME()
    VAR display = LOOKUPVALUE(Table1[User],Table1[Email],user)
    VAR display1 = IF(ISBLANK(display),"Player One", display)
    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,display1)

     

     

     

    eyJrIjoiMjNiMmYxMWQtMDc2OC00ZGY0LWE4NDctZWFlMWU3MjExNzQ4IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9


    @ 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!:
    Mastering Power BI 2nd Edition

    DAX is easy, CALCULATE makes DAX hard...
    Greeting.pbix
    115 KB
    Labels:
    • Labels:
    • Other
    Message 1 of 3
    3,501 Views
    1
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    adanecito
    adanecito Post Patron
    Post Patron
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎04-17-2020 12:54 PM

    Basically I would expect Power BI Pro to supply somehow the user first and last name through a DAX call or something else.

     

    I understand what you proposed though it just would not give me what I want wthout having another table loaded with names with a reference from USERNAME().

     

    Thanks anyway for the response.

    Message 2 of 3
    2,704 Views
    0
    Reply
    HarriG
    HarriG
    New Member
    In response to adanecito
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎07-27-2020 02:29 AM

    Hello,

     

    Just a quick tip. In case username is an email address (I assume typically this is the case), first name can be extracted with these two variables:

    var vFirstNameDigit = SEARCH(".",USERNAME())-1 

    var vFirstName = LEFT(USERNAME(),vFirstNameDigit) 

     

    BR

     

    Harri

    Message 3 of 3
    2,414 Views
    0
    Reply

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Partners
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices