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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
jlarques
Helper V
Helper V

Find job position every month

Dear community,

I have two tables; one is a job postions that develop every employee during a month, that it can be more than one change. The other one is a salary payroll, that depending of the job position and employee can has more than one salary payroll if its job position changes in the same month.

jlarques_2-1717223432333.png

 

My intention is create a table with salary payroll date, employee name and job position. You can see that on the job position table, the empleado1 has same job position from february to april because its position does'nt change, so the table would be:

jlarques_1-1717223409461.png

Do you have any idea to do this?

 

Thanks for your help.

 

José Luis 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula in the Paroll Salary table

Job position = CALCULATE(MAX('Job Position'[JOB POSlTlON]),FILTER('Job Position','Job Position'[EMPLOYEE]=EARLIER('Payroll Salary'[EMPLOYEE])&&'Job Position'[START DАТЕ]<=EARLIER('Payroll Salary'[PAYROLL DATE])&&'Job Position'[END DАТЕ]>=EARLIER('Payroll Salary'[PAYROLL DATE])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula in the Paroll Salary table

Job position = CALCULATE(MAX('Job Position'[JOB POSlTlON]),FILTER('Job Position','Job Position'[EMPLOYEE]=EARLIER('Payroll Salary'[EMPLOYEE])&&'Job Position'[START DАТЕ]<=EARLIER('Payroll Salary'[PAYROLL DATE])&&'Job Position'[END DАТЕ]>=EARLIER('Payroll Salary'[PAYROLL DATE])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

thanks for your quick answer.

 

I'm thinkg about how to implement your code, because job position and payroll salary are fact tables and I have a many to many relationship where job position filters payroll salary, and with FILTER function I cannot access to employee field from the payroll salary table where you comparte employee with employee from both tables.

 

Do you know any formula to access payroll salary with filter in job description with this relationship? RELATED is not working.

 

Thanks @Ashish_Mathur 

My formula has absolutely nothing to do with a relationship between the 2 tables.  Have you even tried it?  What result do you get?  What problem are you facing?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur ,

you're right. I was wrong triying to do it in a different way but creating the column like you write it on a payroll table, I have a column with job position. 

 

Your solution is a right solution. 

 

Thanks for your help, @Ashish_Mathur 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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