2 Replies Latest reply on Apr 15, 2013 1:20 PM by LASLF

    Returning Zero on Calculated Average Days

    LASLF

      Title

      Returning Zero on Calculated Average Days

      Post

           I have a formula to calculate average turn around (in calendar days) for projects in my database:

           (Sum (Days to Complete)/Count (Days to Complete))

           There are instances where projects are completed the same day they're started.  Is there a way to modify this formula to return a value of zero if the result is less than 1?

           The formula to get "Days to Complete" is:

           If (${Tridion Publish (Live)}  ≤ 0;  "" ; (${Tridion Publish (Live)} - Date Rec'd) )

           Thanks in advance for your guidance.

        • 1. Re: Returning Zero on Calculated Average Days
          philmodjunk

               Is days to complete a field in a related table or a repeating field?

               otherwise,

               Sum (Days to Complete)/Count (Days to Complete)

               is the same as

               Days to complete / Days to complete

               which will be 1 in every case where Days to complete is not zero or empty.

               Taking your expression at face value....

               Sum (Days to Complete)/ Max ( Count (Days to Complete) ; 1 )

               Should eliminate the divide by zero error. But you might also take a look at the Average function.

                

          • 2. Re: Returning Zero on Calculated Average Days
            LASLF

                 (Days to complete)/Count(Days to complete) did the trick.  Thanks a million!!!