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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

For a certain value, check its date and return its prior date

I have a list of serial numbers and the date in which they were serviced.

I also did a formula that is identifying the first repair and the duplicate repairs.

But what I would need now is to know the date in which the prior repair came in

 

Serial          Date Serviced             Repeat?

A                 01/01/2019                First Repair

B                 01/01/2019                First Repair

A                 01/05/2019                Duplicate Repair

A                 01/07/2019                Duplicate Repair

 

The expected outcome would be like this

 

Serial          Date Serviced             Repeat?                        Prior Repair Date

A                 01/01/2019                First Repair                   -

B                 01/01/2019                First Repair                   -

A                 01/05/2019                Duplicate Repair           01/01/2019

A                 01/07/2019                Duplicate Repair           01/05/2019

 

Would appreicate your insights on this! I have already searched plenty but could not find something that fits the situation.

Thank you!

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this:

Prior Repair Date =
CALCULATE (
    MAX ( Table1[Date Serviced] ),
    Table1[Date Serviced] < EARLIER ( Table1[Date Serviced] ),
    ALLEXCEPT ( Table1, Table1[Serial] )
)

Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.

Cheers  Datanaut

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @Anonymous 

Try this:

Prior Repair Date =
CALCULATE (
    MAX ( Table1[Date Serviced] ),
    Table1[Date Serviced] < EARLIER ( Table1[Date Serviced] ),
    ALLEXCEPT ( Table1, Table1[Serial] )
)

Please mark the question solved when we get to the solution and consider kudoing if posts are helpful.

Cheers  Datanaut

 

Anonymous
Not applicable

@AlB You are the greatest! Thank you, thank you, thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.