cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
antoniopgouveia Frequent Visitor
Frequent Visitor

Find next value by date

Hi all,

 

I have created an index for a table of opportunities which have an associated date for each entry. I have, then, concatenated the index with the dates (format: YYmmdd) to create my IndexDate column. I would like to find the next IndexDate within the same opportunity (index) and if there is no later entries for a certain opportunity I would like to fill in with the same IndexDate. My desired output is shown in column named NextIndexDate. Is there anyway to do this?

 

IndexDateIndexDateNextIndexDate
120/07/201811807201180730
130/07/201811807301180806
106/08/201811808061180807
107/08/201811808071180807
207/05/201821805072180620
220/06/201821806202180715
215/07/201821807152180715

 

Best regards,

Antonio

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Find next value by date

@antoniopgouveia

 

Try with following

 

Column =
VAR temp =
    TOPN (
        1,
        FILTER ( Table1, [Index] = EARLIER ( [Index] ) && [Date] > EARLIER ( [Date] ) ),
        [Date], ASC
    )
VAR result =
    MINX ( temp, [IndexDate] )
RETURN
    IF ( ISBLANK ( result ), [IndexDate], result )

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Find next value by date

@antoniopgouveia

 

Try with following

 

Column =
VAR temp =
    TOPN (
        1,
        FILTER ( Table1, [Index] = EARLIER ( [Index] ) && [Date] > EARLIER ( [Date] ) ),
        [Date], ASC
    )
VAR result =
    MINX ( temp, [IndexDate] )
RETURN
    IF ( ISBLANK ( result ), [IndexDate], result )

View solution in original post

antoniopgouveia Frequent Visitor
Frequent Visitor

Re: Find next value by date

Hi @Zubair_Muhammad,

 

Thanks for that, it worked perfectly! I just had the filter because it was messing with my index column in relation to original Opportunity ID. They weren't matching to same opportunity ID. As below:

 

NextIndexDate =
VAR temp =
    TOPN (
        1,
        FILTER ( Table1, [Index] = EARLIER ( [Index] ) && [Date] > EARLIER ( [Date] ) && [OpportunityID] = [OpportunityID]),
        [Date], ASC
    )
VAR result =
    MINX ( temp, [IndexDate] )
RETURN
    IF ( ISBLANK ( result ), [IndexDate], result )

 Best regards,

Antonio

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 140 members 1,635 guests
Please welcome our newest community members: