Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

New Column with Max Value

Hello,

 

I trying to create a new cloumn for the employees to be contacted.

the conditions

if the employee belongs to a team. we will contact only one person randomly from that team

if the employee doesn't belong to any team, then we will contact the employee him/herself

 

Structure 

 

Employee Team
Jackteam red
Marcteam green
Adam 
oliverteam red
Nancyteam blue
trishateam red
peter 
Mary 
Connorteam green
hunterteam blue
emily 

 

I expect the new column to be like this :

 

Employee TeamEmployees to be contact
Jackteam redJack
Marcteam greenMarc
Adam Adam
oliverteam red 
Nancyteam blueNancy
trishateam red 
peter peter 
Mary mary
Connorteam green 
hunterteam blue 
emily emily

 

Please any help would be really appreciated .

 

Thanks in advance

  • Here is a calculated column expression with one way to do it to get the result below.  It isn't random but gets the first name alphabetically for each team.

     

     

    Contact =
    VAR thisemployee = Teams[Employee]
    VAR firstemployee =
        CALCULATE (
            MIN ( Teams[Employee] ),
            ALLEXCEPT (
                Teams,
                Teams[Team]
            )
        )
    RETURN
        IF (
            Teams[Team] = "",
            Teams[Employee],
            IF (
                thisemployee = firstemployee,
                firstemployee,
                BLANK ()
            )
        )

     

    Regards,

    Pat

     

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    Here is a calculated column expression with one way to do it to get the result below.  It isn't random but gets the first name alphabetically for each team.

     

     

    Contact =
    VAR thisemployee = Teams[Employee]
    VAR firstemployee =
        CALCULATE (
            MIN ( Teams[Employee] ),
            ALLEXCEPT (
                Teams,
                Teams[Team]
            )
        )
    RETURN
        IF (
            Teams[Team] = "",
            Teams[Employee],
            IF (
                thisemployee = firstemployee,
                firstemployee,
                BLANK ()
            )
        )

     

    Regards,

    Pat

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you so much!