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
Anonymous
Not applicable

Calculate Compensation End Dates of an employee with multiple Compensation Start Dates

Hi all,

 

I need your help creating a correct Compensation End date for my data. 

Employee IdEmployee NameCompensation Start Date
100010David Mayer01/01/2020
100010David Mayer12/14/2020
100010David Mayer02/01/2021
100010David Mayer07/01/2021
100290Jessi Park06/08/2020
100290Jessi Park05/01/2021

 

I created a calculated column:

Compensation End Date =
VAR maxdate =
CALCULATE (
MAX (Compensation[Compensation_Start_Date__c] ),
FILTER (
Compensation,
Compensation[Employee__r.Id] = EARLIER(Compensation[Employee__r.Id])
)
)
RETURN
IF ( Compensation[Compensation_Start_Date__c] = maxdate, BLANK(), maxdate - 1 )
 
Result: 
Employee IdEmployee NameCompensation Start DateCompensation End DateExpected Compensation End Date
100010David Mayer01/01/202006/30202112/13/2020
100010David Mayer12/14/202006/30202101/31/2020
100010David Mayer02/01/202106/30/202106/30/2021
100010David Mayer07/01/2021  
100290Jessi Park06/08/202004/30/202104/30/2021
100290Jessi Park05/01/2021  
 
The formula is doing fine for records with only 2 rows, however, it is not giving me the desired result for employees with >2 records. How can I tweak my formula to return the desired result?  Thank you in advance for your help.

Regards,
Kat
1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

Perhaps this:

Compensation End Date =
VAR NextDate =
    CALCULATE (
        MIN ( Compensation[Compensation Start Date] ),
        FILTER (
            Compensation,
            Compensation[Employee Id] = EARLIER ( Compensation[Employee Id] )
                && Compensation[Compensation Start Date]
                    > EARLIER ( Compensation[Compensation Start Date] )
        )
    )
RETURN
    IF ( NextDate = 0, BLANK (), NextDate - 1 )

Regards

View solution in original post

3 REPLIES 3
Jos_Woolley
Solution Sage
Solution Sage

You're very welcome!

 

Cheers

Jos_Woolley
Solution Sage
Solution Sage

Hi,

Perhaps this:

Compensation End Date =
VAR NextDate =
    CALCULATE (
        MIN ( Compensation[Compensation Start Date] ),
        FILTER (
            Compensation,
            Compensation[Employee Id] = EARLIER ( Compensation[Employee Id] )
                && Compensation[Compensation Start Date]
                    > EARLIER ( Compensation[Compensation Start Date] )
        )
    )
RETURN
    IF ( NextDate = 0, BLANK (), NextDate - 1 )

Regards

Anonymous
Not applicable

@Jos_Woolley It worked perfectly!! Thank you so so much for taking the time to solve my problem! 😊

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.