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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
aflintdepm
Helper III
Helper III

Unmatching dates between payroll dates

Our company has 2 payroll cycles, A & B, that alternate weeks.  Different pay groups are assigned to either A or B.  

 

Occasionally, a correction payroll gets run that falls out of cycle with A or B dates.  Is there a way to assign these out of cycle dates to the correct payroll date depending on cycle?

Example:

Payroll Group A pays on 6/7/24 and 6/21/24

A correction payroll for Group A is run on 6/12/24.  Because this date is after 6/7/24, but before 6/21/24, I would want any values in this correction payroll assigned to the payroll cycle immediately prior.

 

Payroll Dates

Pay DateCycle
6/7/2024A
6/14/2024B
6/21/2024A
6/28/2024B

 

Sample Location Information

LocationPay DateAmountCycle
One6/7/24$100A
Two6/7/24$250A
Three6/14/24$200B
Four6/14/24$250B
One6/12/24$50A

 

Based on the above example, I am looking for output like this

 

Payroll DateLocationTotal
One6/7/24$150
Two6/7/24$250
Three6/14/24$200
Four6/14/24$250
1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

@aflintdepm Hi!

Create these two calculated columns in Location Table:

Previous Pay Date =
VAR CurrentDate = 'Location Table'[Pay Date]
VAR CurrentCycle = 'Location Table'[Cycle]
RETURN
CALCULATE(
    MAX('Payroll Dates'[Pay Date]),
    FILTER(
        'Payroll Dates',
        'Payroll Dates'[Pay Date] < CurrentDate &&
        'Payroll Dates'[Cycle] = CurrentCycle
    )
)
 
Effective Pay Date =
IF(
    'Location Table'[Pay Date] IN VALUES('Payroll Dates'[Pay Date]),
   'Location Table'[Pay Date],
    'Location Table'[Previous Pay Date]
)
 
Then calculate the measure:
Total Amount =
CALCULATE(
    SUM('Location Table'[Amount]),
    ALLEXCEPT('Location Table', 'Location Table'[Effective Pay Date], 'Location Table'[Location])
)
 
and use this in your table, output:
 
BeaBF_0-1721663722513.png

 

BBF

View solution in original post

2 REPLIES 2
ThxAlot
Super User
Super User

Simple enough, just add a calculated column

ThxAlot_0-1721669694285.png

ThxAlot_2-1721669785478.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



BeaBF
Super User
Super User

@aflintdepm Hi!

Create these two calculated columns in Location Table:

Previous Pay Date =
VAR CurrentDate = 'Location Table'[Pay Date]
VAR CurrentCycle = 'Location Table'[Cycle]
RETURN
CALCULATE(
    MAX('Payroll Dates'[Pay Date]),
    FILTER(
        'Payroll Dates',
        'Payroll Dates'[Pay Date] < CurrentDate &&
        'Payroll Dates'[Cycle] = CurrentCycle
    )
)
 
Effective Pay Date =
IF(
    'Location Table'[Pay Date] IN VALUES('Payroll Dates'[Pay Date]),
   'Location Table'[Pay Date],
    'Location Table'[Previous Pay Date]
)
 
Then calculate the measure:
Total Amount =
CALCULATE(
    SUM('Location Table'[Amount]),
    ALLEXCEPT('Location Table', 'Location Table'[Effective Pay Date], 'Location Table'[Location])
)
 
and use this in your table, output:
 
BeaBF_0-1721663722513.png

 

BBF

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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