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.
I'm attempting to figure out how much an employee would cost if they worked full time based on employee start/end dates and pay rates start/end dates against a calendar rather then something like a timesheet.
Employees
Employee | Start Date | End Date | Pay Code |
Athos | 1/1/2022 | A | |
Porthos | 1/1/2022 | B | |
Aramis | 1/1/2022 | C | |
Planchet | 1/1/2022 | 1/4/2022 | A |
PayRates
Pay Code | Start Date | End Date | Rate |
A | 1/1/2022 | 1/3/2022 | 10 |
B | 1/1/2022 | 12/31/2022 | 20 |
C | 1/1/2022 | 12/31/2022 | 30 |
A | 1/4/2022 | 12/31/2022 | 20 |
Calendar
Date | Working Hours |
1/1/2022 | 0 |
1/2/2022 | 0 |
1/3/2022 | 8 |
...etc
Paycodes
Pay Code |
A |
B |
C |
In this case, Plachet's hours should drop off from the 5th onward and Athos and Plachet's hours should change on the 4th.
I can count how many people are working with this measure:
But getting their rate I'm having issues with. Tried:
Solved! Go to Solution.
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Payments measure: =
VAR _workinghrs = [Working Hours:]
VAR _employeetable =
FILTER (
Employee,
Employee[Start Date] <= MAX ( 'Calendar'[Date] )
&& OR (
Employee[End Date] >= MIN ( 'Calendar'[Date] ),
Employee[End Date] = BLANK ()
)
)
VAR _addrate =
ADDCOLUMNS (
_employeetable,
"@Rate",
MAXX (
FILTER (
PayRates,
PayRates[Pay Code] = EARLIER ( Employee[Pay Code] )
&& PayRates[Start Date] <= MAX ( 'Calendar'[Date] )
&& PayRates[End Date] >= MIN ( 'Calendar'[Date] )
),
PayRates[Rate]
),
"@workinghrs", _workinghrs
)
RETURN
SUMX ( _addrate, [@workinghrs] * [@Rate] )
Ha-ha! I see where I screwed up. This works excellently, thank you!
Hi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
Payments measure: =
VAR _workinghrs = [Working Hours:]
VAR _employeetable =
FILTER (
Employee,
Employee[Start Date] <= MAX ( 'Calendar'[Date] )
&& OR (
Employee[End Date] >= MIN ( 'Calendar'[Date] ),
Employee[End Date] = BLANK ()
)
)
VAR _addrate =
ADDCOLUMNS (
_employeetable,
"@Rate",
MAXX (
FILTER (
PayRates,
PayRates[Pay Code] = EARLIER ( Employee[Pay Code] )
&& PayRates[Start Date] <= MAX ( 'Calendar'[Date] )
&& PayRates[End Date] >= MIN ( 'Calendar'[Date] )
),
PayRates[Rate]
),
"@workinghrs", _workinghrs
)
RETURN
SUMX ( _addrate, [@workinghrs] * [@Rate] )
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 |
---|---|
66 | |
54 | |
47 | |
36 | |
34 |
User | Count |
---|---|
84 | |
70 | |
58 | |
45 | |
44 |