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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Ejackson02
New Member

Need help creating a formula to give employee role at the time of the DOS in timesheets

Roles Data

 

Employee IDStart DateEnd DateJob Title
Kate Willson 1/1/20236/3/2023Deputy Director
Kate Willson 6/4/202312/31/2040Director
Jane Doe1/1/20236/4/2023Policy Consultant
Jane Doe6/4/202312/31/2040Senior Policy Consultant
Clay Brown1/1/20236/5/2023HR Generalist
Clay Brown6/4/202312/31/2040Senior HR Generalist
Kelly Price1/1/20236/6/2023Junior Policy Consultant
Kelly Price6/4/202312/31/2040Policy Consultant

 

Timesheet Data

DOSEmployee
1/1/2023Kate Willson
6/4/2023Kate Willson
6/22/2023Kate Willson
6/23/2023Kate Willson
3/6/2023Jane Doe
3/7/2023Jane Doe
6/22/2023Jane Doe
6/23/2023Jane Doe
1/1/2023Clay Brown
6/4/2023Clay Brown
6/22/2023Clay Brown
6/23/2023Clay Brown
3/6/2023Kelly Price
3/7/2023Kelly Price
6/22/2023Kelly Price
6/23/2023Kelly Price

 

I would like the role at the time of the DOS as a third column in the timesheet data. 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Ejackson02 

you can use DAX to create a column

jobtitle = maxx(FILTER('role',role[Employee ID]=timesheet[Employee]&&timesheet[DOS]>='role'[Start Date]&&timesheet[DOS]<=role[End Date]),role[Job Title])

11.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@Ejackson02 

you can use DAX to create a column

jobtitle = maxx(FILTER('role',role[Employee ID]=timesheet[Employee]&&timesheet[DOS]>='role'[Start Date]&&timesheet[DOS]<=role[End Date]),role[Job Title])

11.PNG

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hello Ryan,

Thank you for your response. I was able to create a column and duplicate your results, which produced the correct title for the employee on the given DOS. I’m new to Power BI and have a lot to learn. Thank you for your prompt reply!

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

Make sure your tables are connected by an Employee ID field and then you could try a simple measure like the below:

 

Measure =
CALCULATE(
    MAX('Roles Table'[Job Title]),
    FILTER(
        'Roles Table',
        'Roles Table'[Start Date] <= MAX('Timesheet Table'[DOS]) &&
        'Roles Table'[End Date]>= MAX('Timesheet Table'[DOS])
    )
)
 
DOLEARY85_0-1696696718257.png

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Thank you for such a quick reply! Unfortunately, I could not get the measure to provide the correct titles. The measure would only provide Senior Policy Consultant and Policy Consultant for everyone. I’m new to using Power BI, so I may have transposed a step. I’ll keep trying to see if I can get the correct results. Again, thank you for your reply!  

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.