2 Replies Latest reply on Aug 15, 2018 6:12 PM by wynnb

    Calculate milestone percent complete

    wynnb Specialist

      In the Release records, there is a Schedule tab that shows your milestones and tasks along with a '% Done" column. However, it only show the percent complete on the milestone as 0 or 100. You can manually enter the percent done on the Milestone record, but it seems like it should calculate that on it's own. For example, if there are 4 tasks in a Milestone, each task completed should automatically increment the % complete by 25.

       

      Seems like this could happen in a calculation rule. Does anyone know how to do that? It would have to dynamically count the number of 'live' child tasks (ignoring any that are cancelled or rejected), evaluate the status of each, then calculate the percentage of 'Status = Completed' from the total.

        • 1. Re: Calculate milestone percent complete
          Jonathan.Schmidt SupportEmployee

          Hi Bryan,

           

          I think a calculation rule would serve the need fine.  Off the top of my head I think you'd need a couple of childfold expressions involved to be able to do the count of completed vs total items.

           

          Pseudo-code:
          $(Round(Childfold(fetch children that are complete) / Childfold(fetch total children)))

           

          Here's the help file on childfold.  Use the last parameter childPredicateExpression to filter out those you don't need in each evaluation

          ChildFold

           

          Hope this helps!

          Jon

          1 of 1 people found this helpful
          • 2. Re: Calculate milestone percent complete
            wynnb Specialist

            Jonathan,

             

            I got this to work, but had to do the following (not sure it's the best way...)

            I created two new Number fields in ReleaseMilestone#

            - TasksTotal

            - TasksCompleted

            I created two calculation rules to populate those fields:

            Then I created another Calculation rule to replace the standard Editing rule for Percent Complete, using:

            $(Round(TasksCompleted / TasksTotal * 100))

             

            It works, but does that sound legit or is there a cleaner way?

             

            I tried using the expressions above in a format like your pseudo-code, for example:

            $(Round(ChildFold("ReleaseMilestone#",

                RecId,

                "Task#Assignment.InternalTask",

                $("1"),

                "+",

                $(Status != "Completed"))) /

              ChildFold("ReleaseMilestone#",

              RecId,

              "Task#Assignment.InternalTask",

              $("1"),

              "+",

              $(Status not in ("Cancelled",  "Rejected"))))

             

            but got warnings that the values before and after the '/' were not numeric and couldn't be converted to a number. Yet, they worked individually to populate the fields, so...

             

            Anyway, thanks for the tip!