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
cmilligan262
Helper II
Helper II

Find max date that record doesn't show up

I have a company roster that I pull every monday as well as the first and last day of every month. If someone's employee ID doesn't show up on the next roster I want to show a termination date of 1 day before the next roster entry.

 

For example:

Employee ID:   Name:                 Date of Roster:             Next Date of EID:

EID 1                Person 1              1/1/2020                      1/6/2020

EID 2                Person 2              1/1/2020                      1/5/2020

EID 3                Person 3              1/1/2020                      1/6/2020

EID 1                Person 1              1/6/2020                      

EID 3                Person 3              1/6/2020

 

Thank you for the help

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

try

 

Employee next roster date = minx(filter(table,table[Employee ID]=ealier(table[Employee ID) && table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
next roster date = minx(filter(table,table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
terminate = if(isbalnk(table[Employee next roster date]),table[next roster date]-1,blank())

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

Hi @cmilligan262 ,

 

Please refer to the Calculated Column below which is merged according to amitchandak's formula.

Column = 
var a = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])))
var b = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])&&'Table'[Employee ID]=EARLIER('Table'[Employee ID])))
return
IF(ISBLANK(a),BLANK(),IF(ISBLANK(b),a-1,b))

 Result would be shown as below.

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

try

 

Employee next roster date = minx(filter(table,table[Employee ID]=ealier(table[Employee ID) && table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
next roster date = minx(filter(table,table[Date of Roster] >earlier(table[Date of Roster])),(table[Date of Roster]))
terminate = if(isbalnk(table[Employee next roster date]),table[next roster date]-1,blank())

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

What if I'm trying to do it as a calculated column in the table?

Anonymous
Not applicable

Hi @cmilligan262 ,

 

Please refer to the Calculated Column below which is merged according to amitchandak's formula.

Column = 
var a = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])))
var b = CALCULATE(MIN('Table'[Date of Roster]),FILTER('Table','Table'[Date of Roster]>EARLIER('Table'[Date of Roster])&&'Table'[Employee ID]=EARLIER('Table'[Employee ID])))
return
IF(ISBLANK(a),BLANK(),IF(ISBLANK(b),a-1,b))

 Result would be shown as below.

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors