Forum Discussion

nchamilton2's avatar
nchamilton2
Frequent Visitor
1 year ago
Solved

Handling blanks

How do I return "Unassigned" in my table visual when the User doesn't exist? See example below. Ultimately I want to do some counts of projects by user and show how many are unassigned in a table.
I want to add a table visual that shows a Name column and shows "Unassigned" where the User is not assigned. So my table visual would look like the following:

Name | ProjectId
Jim 123
Bob 456

Mike 789

Unassigned | 987

Example:
Table1
UserId | Name
1 Jim

2 Bob

3 Mike

Table2
UserId | ProjectId
1 123
2 456
3 789
4 987


  • Hi nchamilton2 ,

    Please create the following measure:

    Project Name =
    VAR AssignedName =
    LOOKUPVALUE(
    Table1[Name],
    Table1[UserId],
    SELECTEDVALUE(Table2[UserId])
    )
    RETURN
    IF(
    ISBLANK(AssignedName),
    "Unassigned",
    AssignedName
    )

    Add the Project Name measure and ProjectId from Table2 to your table visual.

    This measure will return the actual name if it exists or "Unassigned" if there’s no match.

    Expected Output

    Name ProjectId
    Jim123
    Bob456
    Mike789
    Unassigned987
  • Hi nchamilton2 create a calculated column in table 2

     

    DisplayName =
    VAR User= LOOKUPVALUE(table1[Name], table1[UserID], table2[userid])
    RETURN IF(ISBLANK(User), "Unassigned", User)

5 Replies

  • Hi nchamilton2 ,

    Please create the following measure:

    Project Name =
    VAR AssignedName =
    LOOKUPVALUE(
    Table1[Name],
    Table1[UserId],
    SELECTEDVALUE(Table2[UserId])
    )
    RETURN
    IF(
    ISBLANK(AssignedName),
    "Unassigned",
    AssignedName
    )

    Add the Project Name measure and ProjectId from Table2 to your table visual.

    This measure will return the actual name if it exists or "Unassigned" if there’s no match.

    Expected Output

    Name ProjectId
    Jim123
    Bob456
    Mike789
    Unassigned987
  • Hi nchamilton2 create a calculated column in table 2

     

    DisplayName =
    VAR User= LOOKUPVALUE(table1[Name], table1[UserID], table2[userid])
    RETURN IF(ISBLANK(User), "Unassigned", User)
  • v-karpurapud's avatar
    v-karpurapud
    Icon for Community Support rankCommunity Support

    Hi nchamilton2 

    Could you please confirm if your query have been resolved the solution provided by MattiaFratello  and techies ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

     

    Thank you

  • v-karpurapud's avatar
    v-karpurapud
    Icon for Community Support rankCommunity Support

    Hi nchamilton2 

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

    Thank you.

  • v-karpurapud's avatar
    v-karpurapud
    Icon for Community Support rankCommunity Support

    Hi nchamilton2 

    I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

    Thank you.