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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Anonymous
Not applicable

lookup an employee and return role based on date entry was made

Hi gang 

 

I have been trolling through as many questions as I can and you have been super helpful before so maybe someone can help me again 🙂

 

I have two tables in a larger data set 

 

Table 1: 

Has all time entries submitted by all employees (EMPLID) and the date the entry was made (TRANSDATE) 

 

Table 2: 

Role table with start and end date of roles and promo's 

 

The EMPLID will be duplicated in the EMPLID column if the person has had a 'role name' change in the system - each change is time stamped, the start (CREATED) and end date (Latest date) of the role are next to each occurance of the EMPLID in table 2.

 

*if the role hasnt been edited it will return todays date in latest date

ALemmy_0-1609781417387.png

 

What I need to do is look up the EMPLID in table 1 and TRANSDATE table 1 and match it to the correct role NAME for that EMPLID in table 2. 

 

I used to have a lookup formula that worked fine when I didnt have EMPLID duplications in table 2 so now I need to implement this change to keep track of changing roles in a project and implement the right rate throughout the life of it. 

 

If anyone can give me any pointers it would really help 🙂 

 

Thank you all and HAPPY NEW YEAR 

Anne

 

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous try this as a new column in your task table, change col and table name as per your model.

 

Role = 
VAR __taskDate = Tasks[TaskDate]
VAR __empId = Tasks[EmpId]
RETURN
CALCULATE ( 
    LASTNONBLANK ( Emp[Role], TRUE() ), 
    __empId = Emp[EmpId],
    __taskDate >= Emp[Start],
    __taskDate <= Emp[End]
) 

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@Anonymous Appreciate the feedback and glad it worked out. I would like to say, you explained your problem very well, and it was fun to work with. Cheers!!

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous try this as a new column in your task table, change col and table name as per your model.

 

Role = 
VAR __taskDate = Tasks[TaskDate]
VAR __empId = Tasks[EmpId]
RETURN
CALCULATE ( 
    LASTNONBLANK ( Emp[Role], TRUE() ), 
    __empId = Emp[EmpId],
    __taskDate >= Emp[Start],
    __taskDate <= Emp[End]
) 

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

THANK YOU SO MUCH ... honestly and your break down is super helpful to understand 

 

be blessed 

 

Anne

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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