cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Select Next date in column

Hi There, 

 

I want to create a measure which gives the next date in the column for the entityID in that row. For instance, in the table below, I want a new column which, let's say entity ID 92 the date is 29/06/2021 then it needs to give the date 29/09/2021. 

 

Annemie19_0-1598955602924.png

 

1 ACCEPTED SOLUTION
Super User II
Super User II

@Annemie19  You can use this:

 

Column = 
VAR CurrentRowEntity = Anne[EntityID]
VAR CurrentRowDate = Anne[MeasurementDate]
VAR SameRows =
    FILTER (
        Anne,
        Anne[EntityID] = CurrentRowEntity
            && Anne[MeasurementDate] > CurrentRowDate
    )
VAR Result =
    MINX ( SameRows, Anne[MeasurementDate] )
RETURN
    IF ( Result = BLANK (), CurrentRowDate, Result )

1.PNG


Thank you,
Antriksh Sharma

View solution in original post

2 REPLIES 2
Super User II
Super User II

@Annemie19  You can use this:

 

Column = 
VAR CurrentRowEntity = Anne[EntityID]
VAR CurrentRowDate = Anne[MeasurementDate]
VAR SameRows =
    FILTER (
        Anne,
        Anne[EntityID] = CurrentRowEntity
            && Anne[MeasurementDate] > CurrentRowDate
    )
VAR Result =
    MINX ( SameRows, Anne[MeasurementDate] )
RETURN
    IF ( Result = BLANK (), CurrentRowDate, Result )

1.PNG


Thank you,
Antriksh Sharma

View solution in original post

Super User IV
Super User IV

@Annemie19 , try a new column like

minx(filter(table, [entityID] = earlier([entityID]) && [measuredate] >earlier([measuredate])),[measuredate])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.