Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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:
Bonus table:
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.
Employee | Payment date | Discretionary Bonus Amount | Base Salary Date | Pay Rate | Percentage from salary |
415 | 2/15/2020 | 3900 | 7/1/2019 | 156,000 | 2.50% |
415 | 2/15/2021 | 2000 | 7/1/2019 | 156,000 | 1.28% |
415 | 2/15/2022 | 6000 | 1/1/2022 | 165,000 | 3.64% |
Thanks!
Solved! Go to Solution.
@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)
@cristianjsheld Kudo's to you for providing a clear explanation, sample data and expected output! Helps soooooooo much!!
@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)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |