Forum Discussion

wilson_smyth's avatar
wilson_smyth
Post Patron
8 years ago
Solved

How does earlier work correctly when table is not ordered?

  I have a measure, which finds the most recent event a person attended. It works correctly, but im not fully sure why.   It does this via a calculate column (shown below), that uses the earlier f...
  • Zubair_Muhammad's avatar
    8 years ago

    Hi wilson_smyth

     

    EARLIER returns the CurrentRow on which the calculation is performed ......Not the PreviousOne which the name literally implies

     

    This name is slighty confusing. Some experts suggest that the name of EARLIER should be CURRENTROW. But technically EARLIER refers to EARLIER row context which becomes hidden when a new ROW context is introduced for example by an ITERATOR

     

  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    wilson_smyth

     

    You are right

    CurrentRow (retrived using EARLIER) is compared with every ROW of the Table used by the ITERATOR (FILTER is the iterator here)

     

    All ITERATORS (like FILTER, SUMX etc) typically have two arguments...One is Table Expression, second is the Expression which is evaluated for every row of the Table passed as first argument