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
CVanpat91
Frequent Visitor

Determine the next date a value appears

Hello,

 

I have a set of data where a certain value appears multiple times.  I want to know the next date that the value appears.  Example below of data.  

NameDate
Blue1/1/2022
Red8/4/2021
Blue5/1/2021
Blue4/2/2021
Green4/1/2021
Green2/3/2021

 

Example of what I need for results: 

NameDateNext Date
Blue1/1/2022null
Red8/4/2021null
Blue5/1/20211/1/2022
Blue4/2/20215/1/2021
Green4/1/2021null
Green2/3/20214/1/2021

 

 

Any help would be greatly appreciated.  Thank you in advance!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @CVanpat91 

you can create new column

Next Day =
VAR NameTable =
    CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Name] ) )
VAR NextDatesTable =
    FILTER ( NameTable, Data[Date] > EARLIER ( Data[Date] ) )
VAR NextDate =
    MINX ( NextDatesTable, Data[Date] )
RETURN
    NextDate

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @CVanpat91 

you can create new column

Next Day =
VAR NameTable =
    CALCULATETABLE ( Data, ALLEXCEPT ( Data, Data[Name] ) )
VAR NextDatesTable =
    FILTER ( NameTable, Data[Date] > EARLIER ( Data[Date] ) )
VAR NextDate =
    MINX ( NextDatesTable, Data[Date] )
RETURN
    NextDate

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.