Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
Jack | team red |
Marc | team green |
Adam | |
oliver | team red |
Nancy | team blue |
trisha | team red |
peter | |
Mary | |
Connor | team green |
hunter | team blue |
emily |
I expect the new column to be like this :
Employee | Team | Employees to be contact |
Jack | team red | Jack |
Marc | team green | Marc |
Adam | Adam | |
oliver | team red | |
Nancy | team blue | Nancy |
trisha | team red | |
peter | peter | |
Mary | mary | |
Connor | team green | |
hunter | team blue | |
emily | emily |
Please any help would be really appreciated .
Thanks in advance
Solved! Go to Solution.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thank you so much!
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
8 | |
7 |