Can I use a field to get the sum value of another field between certain period?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chrisjiang
    Member
    • Dec 2018
    • 88

    Can I use a field to get the sum value of another field between certain period?

    Hi,

    I want to set a field (say "amountSum") in "Opportunity" entity and make its value as "sum of amount in past 30 days (or in current month)". How can I achieve this?

    amountSum = sum of "amount" in current month.

    Thanks for help.
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi there,
    Could you explicit it? Do you you want to create a field in Opportunity to store there the sum value of the all Opportunity records amount in the current month?

    Comment

    • chrisjiang
      Member
      • Dec 2018
      • 88

      #3
      Thanks for your attention.

      Yes what I want to do is as follows:

      1. in entity Opportunity onlly
      2. create a field "amountSum"
      3. make "amountSum" store the sum value of Opportunity records filtered by conditions like: certain user + current month.

      Is it possible to achieve this?

      Thanks again.

      Comment

      • item
        Active Community Member
        • Mar 2017
        • 1476

        #4
        Hello,
        if you have the "must have" AdvancedPack .. yes
        else, you can do.. i think so :
        create a readOnly field "float:sumAmount" in user entity
        with formula, sumRelated( ..... lastMonth ).. certainly need to make a filter.
        If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

        Comment

        • chrisjiang
          Member
          • Dec 2018
          • 88

          #5
          Originally posted by item
          Hello,
          if you have the "must have" AdvancedPack .. yes
          else, you can do.. i think so :
          create a readOnly field "float:sumAmount" in user entity
          with formula, sumRelated( ..... lastMonth ).. certainly need to make a filter.
          Yes I have Advanced Pack.

          But how can I apple the formula entity\sumRelated(LINK, FIELD, FILTER) in the same entity? What "LINK" name shall I put into the formula?

          Thanks.

          Comment

          • item
            Active Community Member
            • Mar 2017
            • 1476

            #6
            like so ?
            i don't use opportuinity so filter must certainly another date field
            If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

            Comment

            • chrisjiang
              Member
              • Dec 2018
              • 88

              #7
              Originally posted by item
              like so ?
              i don't use opportuinity so filter must certainly another date field
              Yes using report function it is easy to get the sum value. What I want to do is to set a field to store all the sum value of the "amount" of records created in a month......

              Thanks.

              Comment

              • Maximus
                Senior Member
                • Nov 2018
                • 2731

                #8
                It is not possible to get the sum value of the records of the same entity of a certain period via UI. I believe it is possible to achieve with Hook https://docs.espocrm.com/development/hooks/.

                Comment

                • chrisjiang
                  Member
                  • Dec 2018
                  • 88

                  #9
                  Originally posted by Maximus
                  It is not possible to get the sum value of the records of the same entity of a certain period via UI. I believe it is possible to achieve with Hook https://docs.espocrm.com/development/hooks/.
                  got it. thanks very much.

                  Comment

                  Working...