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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
lizzy
Helper I
Helper I

Most recent previous date

HI I have a table that looks something like this

Person IDDate
A12/31/2019
A12/1/2019
A10/2/2019
A6/1/2019
B12/10/2019
B10/1/2019
C6/12/2019
C3/1/2019
C2/19/2019

 

For each row, I want to calculate what the previous date was, for that person.

For example:

Person IDDatePrevious
A12/31/201912/1/2019
A12/1/201910/2/2019
A10/2/20196/1/2019
A6/1/2019 
B12/10/201910/1/2019
B10/1/2019 
C6/12/20193/1/2019
C3/1/20192/19/2019
C2/19/2019 

How can I do this?

1 ACCEPTED SOLUTION
Adamtall
Resolver III
Resolver III

Previous date =
var date_ = 'Table'[Date]
var ID_ = 'Table'[Person ID]
return
CALCULATE(MAX('Table'[Date]);FILTER(ALL ('Table') ; 'Table'[Person ID] = ID_ && 'Table'[Date] < date_))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

In case you want a column

new column = maxx(filter(table, table[personID]=earlier(table[personID]) && table[Date]<earlier(table[Date])),table[Date])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Adamtall
Resolver III
Resolver III

Previous date =
var date_ = 'Table'[Date]
var ID_ = 'Table'[Person ID]
return
CALCULATE(MAX('Table'[Date]);FILTER(ALL ('Table') ; 'Table'[Person ID] = ID_ && 'Table'[Date] < date_))
littlemojopuppy
Community Champion
Community Champion

Hi!  Take a look at this

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.