14 Replies Latest reply: Jul 21, 2016 8:00 AM by Jyoti Ranjan RSS

    How to Calculate Previous Date Value for a Dimension in Script

    Jyoti Ranjan

      Hi ,

      how to calculate Previous Date value for a Dimension in Script.

      I have already used Previous().But here i am getting previous row data.but i need Previous date data.bcz in some cases Exact previous date is not available.

      If i have 14th Jul,15th Jul ,16th Jul and 19th Jul data then i m getting problem for creating 19th Jul Dimension Data.bcz there is no 18th Jul data.it extracts 16th Jul data(Previous row).

      I have to add an row with a dimension name and its value with previous date value.

      Ex:

      Current Credit Of Add to reimbursement=X+Y+Z+Previous date Credit of Add to reimbursement

      X,Y,Z are other previous date values for other dimensions.

       

       

      Please help me to find out the solution.

       

       

       

      Thanks

        • Re: How to Calculate Previous Date Value for a Dimension in Script
          Miguel Braga

          Hey there Jyoti Nath,

           

          I know what exactly you need. You need to create a Master Calendar. Doing so you get rid of problems when finding dates in between the ones you have. Take a careful look at this post in community:

           

          Creating A Master Calendar

           

          This guide will help you to deal with your questions

           

          Hope this helps.

           

          Regards,

          MB

            • Re: How to Calculate Previous Date Value for a Dimension in Script
              Jyoti Ranjan

              Hi,

              I have some dimensions.lets say

              Account Type      Credit    Date

              A                          200        06/06/2016

              A                          200      06/07/2016

              A                          200      07/07/2016

              A                        4000        14/07/2016

              A                        5000      15/07/2016

              X                        1000       06/06/2016

              X                        1000      06/07/2016

              X                        1000      07/07/2016

              X                        4000        14/07/2016

              X                        5000      15/07/2016

               

               

               

               

              Then i have to create another row.

              Account Type        Credit                                                                                                              Date

              P                       A.Credit+X.Credit  of previous date(05/06/2016)                                                      06/06/2016

              P                       A.Credit+X.Credit  of previous date  (05/07/2016)                                                     06/07/2016

              P                       A.Credit+X.Credit  of previous date  (06/07/2016)                                                      07/07/2016

              P                      A.Credit+X.Credit  of previous date  (13/07/2016)                                                       14/07/2016

              P                     A.Credit+X.Credit  of previous date     (14/07/2016)                                                     15/07/2016

            • Re: How to Calculate Previous Date Value for a Dimension in Script
              Sunny Talwar

              Do you have some sample data with which we can try to help you better?

                • Re: How to Calculate Previous Date Value for a Dimension in Script
                  Jyoti Ranjan

                  Hi,

                  I have some dimensions.lets say

                  AccountType   Credit        Date

                  A                 200        06/06/2016

                  A                 200        06/07/2016

                  A                 200        07/07/2016

                  A                 4000        14/07/2016

                  A                 5000       15/07/2016

                  X                 1000       06/06/2016

                  X                 1000       06/07/2016

                  X                 1000       07/07/2016

                  X                 4000        14/07/2016

                  X                 5000        15/07/2016

                   

                   

                   

                   

                   

                   

                   

                   

                   

                   

                  AccountType    Credit                                                         Date

                  P             A.Credit+X.Credit  of previous date(05/06/2016)    06/06/2016

                  P             A.Credit+X.Credit  of previous date(05/07/2016)    06/07/2016

                  P             A.Credit+X.Credit  of previous date(06/07/2016)    07/07/2016

                  P             A.Credit+X.Credit  of previous date(13/07/2016)    14/07/2016

                  P             A.Credit+X.Credit  of previous date(14/07/2016)    15/07/2016

                    • Re: How to Calculate Previous Date Value for a Dimension in Script
                      Jyoti Ranjan

                      My table:

                      AccountType      Credit    Date

                      A                 200        06/06/2016

                      A                 200        06/07/2016

                      A                 200        07/07/2016

                      A                 4000        14/07/2016

                      A                 5000       15/07/2016

                      X                 1000       06/06/2016

                      X                 1000       06/07/2016

                      X                 1000       07/07/2016

                      X                 4000        14/07/2016

                      X                 5000        15/07/2016

                       

                       

                       

                       

                       

                       

                       

                       

                      Required rows to insert in My Table

                      AccountType   Credit                                                                        Date

                      P             A.Credit+X.Credit+P.Credit  of previous date(05/06/2016)    06/06/2016

                      P             A.Credit+X.Credit+P.Credit  of previous date(05/07/2016)    06/07/2016

                      P             A.Credit+X.Credit+P.Credit  of previous date(06/07/2016)    07/07/2016

                      P             A.Credit+X.Credit+P.Credit  of previous date(13/07/2016)    14/07/2016

                      P             A.Credit+X.Credit+P.Credit  of previous date(14/07/2016)    15/07/2016