1 Reply Latest reply on Apr 11, 2018 10:52 AM by Nathan Panuco

    Efficiency of nested calcs?

    Joe Oppelt

      I'm trying to figure out if there is a processing efficiency to nesting calcs.  I like to compartmentalize my calcs.  Create a calc for an intermediate step in a complex calculation.  Use that intermediate calc instead of making the intermediate step part of the final calc.

       

      Example:

       

      // intermediate step 1

      IF (a whole bunch of conditions here) THEN 1 else 0 END

       

      // intermediate step 2

      IF [Intermediate 1] = 1 AND (more conditions here) THEN "RED"

      elseif [Intermediate 1] = 0 AND (other conditions here) THEN "BLUE"

      else

      "BLACK"

      end

       

      // final calc

       

      CASE [Intermediate 2]

      .

      .

      .

       

      I could collapse all that into one giant, messy calc.  Would one calc run more efficiently than three?

       

      And I suppose the question might have different answers if these calcs are row-level calcs, aggregate calcs, table calcs or LOD calcs.

       

      Is there a general rule of thumb about this sort of stuff?