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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Assign to team based on date

Hello,

 

I am having hard time assigning teams from an Employee reference table that has the employee name, their assign teams and date they join that time. I am using Lookupvalue to get the assign team and adding that to the sales table. But when I try to do this, a duplicate error shows up.

 

This is how the tables look:

learn2fly_0-1635489065710.png

 

learn2fly_1-1635489091807.png

 

This is how it should look(I use Sql to join the two tables):

Select S.*,
       EmpRef.Team


From Sales as S
OUTER APPLY(
SELECT TOP 1 E.Team
FROM EmployeeRefernce as E
WHERE	E.Employee = S.Employee
		AND E.EffectiveDay <= S.CreateDay
ORDER BY E.EffectiveDay DESC) AS EmpRef

 

learn2fly_2-1635489757993.png

 

Please any assist or help is greatly appreciated.Thank you so much!

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a new colum like this sales

 

new column =
var _max = maxx( filter(Sales_Table, Sales_Table[Employee] = EmployeeRefernce [Employee] && EmployeeRefernce [EffectiveDay] <= Sales_Table[CreateDay] ),EmployeeRefernce[EffectiveDay] )
return
maxx( filter(Sales_Table, Sales_Table[Employee] = EmployeeRefernce[Employee] && EmployeeRefernce[EffectiveDay]= _max),EmployeeRefernce[Team] )

Anonymous
Not applicable

Hi amitchandak,  thank you for looking into this. I am getting this error:

table of multiple values was supplied where a single value was expected.



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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