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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft 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.

 

mahoneypat_0-1602799130049.png

 

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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Microsoft Employee
Microsoft 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.

 

mahoneypat_0-1602799130049.png

 

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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Thank you so much!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.