Power BI Exchange

Please login or click SIGN UP FOR FREE to create your PowerBIUG account to join this user group.
Expand all | Collapse all

Create a measure to show the user's first name

  • 1.  Create a measure to show the user's first name

    Top Contributor
    Posted 14 days ago
      |   view attached
    Hi, Scratching my head on this one.

    I have a table consisting of user principle name and user name.  I'd like to display the user's logged in name, ie their first name.

    The table consists of the following example data.

    When I log in as bhoward@acmeltd, which I can determine using the function USERPRINCIPLENAME(), I would like the measure to return "Ben".

    Anyone got any DAX that would do that please?  File attached.



    ------------------------------
    Ben Howard, UK.

    Please mark any answer as recommended if it helps you.
    ------------------------------

    Attachment(s)

    pbix
    PBIUG.pbix   15 KB 1 version


  • 2.  RE: Create a measure to show the user's first name

    Top Contributor
    Posted 14 days ago
    Fixed this with a bit of thought...

    Welcome =
    VAR user = USERNAME()
    VAR welcome = LOOKUPVALUE(Employee[EmployeeName],Employee[EmployeeUPN],user)
    RETURN
    CONCATENATE( "Hello " , right(welcome, LEN(welcome)-SEARCH(",", welcome)-1))


    ------------------------------
    Ben Howard, UK.

    Please mark any answer as recommended if it helps you.
    ------------------------------