How to get record before and after in forall loop powerapps

I am trying to run a function that returns a table with a corresponding date index and date text. This is so that I can display the information in a tutorial screen. However, I am confused on how to access to the previous record. Here is my pseudocode:

ForAll( Tweets (sorted by crf1d_date_index),
        If(the record IS NOT the LAST record,
             If('crf1d_date_index' != 'crf1d_date_index' of the NEXT record,
                     { 
                           Step: crf1d_date_index, 
                           Text: crf1d_tweet_time 
                     }
               )
           )

        If(the record IS the LAST record,
             If('crf1d_date_index' != 'crf1d_date_index' of the PREVIOUS record),
                     { 
                           Step: crf1d_date_index, 
                           Text: crf1d_tweet_time 
                     }
               )

)
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum