3 Replies Latest reply: Apr 28, 2018 3:30 AM by Sumanta Kumar Mandal RSS

    Calculation between two

    An Pham

      Dear All

      i want to calculation sum of values from two date columns

      Here is my sample data

      UserIDCutOffDateTransDateAmount
      User013/12/20183/10/201810
      User013/12/20183/11/201810
      User013/12/20183/12/201810
      User013/12/20183/13/201810
      User013/12/20183/14/201810
      User013/12/20183/15/201810
      User013/12/20183/16/201810
      User023/15/20183/14/201810
      User023/15/20183/15/201810
      User023/15/20183/16/201810

       

      i want to get Sum of Amount between Cutoffdate And Max selected Transdate for each UserID

      Example:

      if no Transdate selected, it mean Max(TransDate) =   '3/16/2018'

      here my expected result

       

      UserIDSum AmountDescription
      User0150Sum of Amount from Cutoffdate of User01 (3/12/2018) to Max(TransDate) ('3/16/2018')
      User0220Sum of Amount from Cutoffdate of User02 (3/15/2018) to Max(TransDate) ('3/16/2018')


      if selected Transdate ='3/14/2018'

      here my expected result

       

      UserIDSum AmountDescription
      User0130Sum of Amount from Cutoffdate of User01 (3/12/2018) to Max(TransDate) ('3/14/2018')
      User020Because Cutoffdate > Max(TransDate)


      but i am not sure how to write expression correctly.

       

      Any help would be appreciated.

      Thanks in advanced

      An Pham