13 Replies Latest reply: Sep 29, 2017 12:14 AM by Rex Liao RSS

    How to get the 2nd nearest date without using Max(Date,2)?

    Rex Liao

      Dear all,

      Just have a question to get the 2nd nearest date without using Max(Date,2).

       

      Currently, I use the following syntax to get Sum(Shares) on the nearest date, and it woks fine.

      Sum(Aggr(Sum({$< Report_Date={"$(     =Max(Report_Date)     )"} >} Shares), Security_ID) )

       

      However, when I tried to get the 2nd nearest date without using Max(Date,2) for some concerns, I used the following syntax

      Max({<  Report_Date={     "<=$(=Date(Max(Report_Date)-1,'YYYY/MM/DD'))"     } >} Report_Date)

       

      to replace

      Max(Report_Date)

       

      But it didn't work, is anyting wrong here?

      It's appreciated if someone can help me out here.