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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Average Overtime for the last 3 pay periods

Hi, requesting some assistance/insight on how to create a measure for the "overtime average of the last 3 pay periods." Based on the sample data below this would be the average of CYPP: 2112, 2113, and 2114. However, when data for next period is available, this would be for CYPP: 2113, 2114, and 2115 and so on every time a new pay period is added.

 

My end goal is to create a measure which subtracts the "overtime average of the last 3 pay periods" from the "overtime average across ALL pay periods". In the screenshot below, 5,064.81 - 5,552.17 = -487.37

 

Creating the measure for "overtime average across ALL pay periods" was fairly straight forward. This is what that measure looks like:

FY PP AVG =
AVERAGEX(
    KEEPFILTERS(VALUES('SAMPLE'[CYPP])),
    CALCULATE(SUM('SAMPLE'[AMT])))

 

I am able to accomplish the "overtime average of the last 3 pay periods" in a table by utilizing the Top N Filter (as pictured below), however, I cannot figure out how to create a measure which results in the same data, 5,064.81. 

MOcampo_1-1628177154216.png

 

This is the sample data used: (CYPP=Calendar Year Pay Period)

CYPPNAME AMT DEPARTMENT
2020SAL   2,048.69A
2020MIKE      860.96A
2020KIM   3,056.68B
2021SAL   1,428.96A
2021MIKE   1,932.96A
2021KIM   1,966.61B
2021JON   2,048.69C
2022SAL      860.96A
2022MIKE   3,056.68A
2022KIM   1,428.96B
2023SAL   1,932.96A
2024SAL   1,966.61A
2024MIKE   2,202.18A
2025SAL   2,235.83A
2025MIKE   2,269.49A
2025KIM   2,303.14B
2025JON   2,048.69C
2025BOB      860.96C
2026SAL   3,056.68A
2026MIKE   1,428.96A
2101SAL   1,932.96A
2101MIKE   1,966.61A
2102SAL   2,538.71A
2102MIKE   2,572.36A
2102KIM   2,606.02B
2102JON   2,639.67C
2103SAL   2,673.32A
2103MIKE   2,706.97A
2103KIM   2,740.63B
2104SAL   2,774.28A
2104MIKE   2,048.69A
2105SAL      860.96A
2105MIKE   3,056.68A
2106SAL   1,428.96A
2106MIKE   1,932.96A
2107SAL   1,966.61A
2107MIKE   3,009.85A
2108SAL   3,043.50A
2108MIKE   3,077.16A
2108KIM   3,110.81B
2109SAL   3,144.46A
2109MIKE   3,178.12A
2110SAL   2,048.69A
2110MIKE      860.96A
2111SAL   3,056.68A
2111MIKE   1,428.96A
2112SAL   1,932.96A
2112MIKE   1,966.61A
2112KIM   2,048.69B
2113SAL      860.96A
2113MIKE   3,056.68A
2114SAL   1,428.96A
2114MIKE   1,932.96A
2114KIM   1,966.61B

 

Any suggestions, or solutions would be greatly appreicated!

 

Thank you, 

Marc

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Picture2.png

 

Link to the sample pbix file 

 

 



Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Picture2.png

 

Link to the sample pbix file 

 

 



Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



Anonymous
Not applicable

This was perfect, thank you! 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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