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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
cristianjsheld
Frequent Visitor

Salary Table Vs Bonus Table Salary

Hi, 

 

I've got a table with the historical data on the salaries, with their corresponding effective date, and another with bonuses amount with their payment date. I need to create a measure/column/table (I don't know which could be the best way to do it) to know from the bonuses paid which is the percentage over salary. Something like this:

 

Salary table:

cristianjsheld_1-1663595530417.png

Bonus table:

cristianjsheld_0-1663595501063.png

 

The logic should work from the bonus amount relating to the payment date and the compensation effective date, where the bonus will be calculated over the latest salary based on the date (the bonus paid on 02/15/2020 will be calculated over the salary with a compensation date 07/01/2019 as it was the latest salary prior the bonus payment date). I have a calendar table where the payment date and the compensation date are connected.

 

EmployeePayment dateDiscretionary Bonus AmountBase Salary Date Pay Rate Percentage from salary
4152/15/202039007/1/2019         156,0002.50%
4152/15/202120007/1/2019         156,0001.28%
4152/15/202260001/1/2022         165,0003.64%

 

Thanks!

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@cristianjsheld Maybe:

Measure =
  VAR __Employee = MAX('Bonus'[Employe #])
  VAR __Bonus = MAX('Bonus'[Bonus Amount])
  VAR __PayDate = MAX('Bonus'[Payment Date])
  VAR __LastCompDate = MAXX(FILTER(ALL('Salary'),'Salary'[Employee #] = __Employee && 'Salary'[Compensation: Date] <= __PayDate), 'Salary'[Compensation: Date])
  VAR __PayRate = MAXX(FILTER(ALL('Salary'), 'Salary'[Employee #] = __Employee && 'Salary'[Compensation: Date] = __LastCompDate ), 'Salary'[Pay rate])
RETURN
  DIVIDE(__Bonus, __PayRate,0)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
cristianjsheld
Frequent Visitor

Amazing @Greg_Deckler . It worked on the first try.

@cristianjsheld Kudo's to you for providing a clear explanation, sample data and expected output! Helps soooooooo much!!



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Community Champion
Community Champion

@cristianjsheld Maybe:

Measure =
  VAR __Employee = MAX('Bonus'[Employe #])
  VAR __Bonus = MAX('Bonus'[Bonus Amount])
  VAR __PayDate = MAX('Bonus'[Payment Date])
  VAR __LastCompDate = MAXX(FILTER(ALL('Salary'),'Salary'[Employee #] = __Employee && 'Salary'[Compensation: Date] <= __PayDate), 'Salary'[Compensation: Date])
  VAR __PayRate = MAXX(FILTER(ALL('Salary'), 'Salary'[Employee #] = __Employee && 'Salary'[Compensation: Date] = __LastCompDate ), 'Salary'[Pay rate])
RETURN
  DIVIDE(__Bonus, __PayRate,0)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.