topic Re: Order of Lookups and SUM in formulas in Anaplan Platform
https://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52963#M8160
<P>Thanks David.</P><P> </P><P>And if besides the Lookups and SUMs, there is SELECT in some form as well (assuming best practice of not have SUM/LOOKUP together), would SELECT get some sort of preference?</P>Fri, 11 Oct 2019 04:26:54 GMTshreyak.garg2019-10-11T04:26:54ZOrder of Lookups and SUM in formulas
https://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52961#M8158
<P>Hi,</P><P> </P><P>I was going through a best practice video which mentioned that the order of lists in the module can help improve the performance if the lists are ordered similar to their order in General Lists section (because indexing becomes easier for the engine).</P><P> </P><P>I was wondering if there is a similar best practice when it comes to the formulas itself?</P><P> </P><OL><LI>Is there an order in which we should be putting the SUM/LOOKUP functions (assuming the formula has 2 lookups together)?</LI><LI>If you are multiplying 2 different numbers say an assumption % (from a small assumptions module) and a total number (from a module of same size), does the order of the selection matter in terms of performance? E.g. Is <STRONG>"Assumption%[Lookup:X] * Total"</STRONG> quicker than <STRONG>"Total * Assumption%[Lookup:X]" ?</STRONG></LI></OL><P> </P><P>Looking forward to the response from the community.</P>Fri, 11 Oct 2019 04:00:45 GMThttps://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52961#M8158shreyak.garg2019-10-11T04:00:45ZRe: Order of Lookups and SUM in formulas
https://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52962#M8159
<P><LI-USER uid="7949"></LI-USER> </P><P>Great question.</P><P>I believe the answer is no. The formula is broken down into the various parts and the SUMs are always completed first., then the LOOKUPs, then the remainder. Also if you have multiple SUMs or multiple LOOKUPs, the order doesn't matter. However, for readability, and consistency, I advocate keeping the order the same. So if your dimension order is Customer, Product, Time and you have a double lookup, I would have something like:</P><P>...[LOOUKP:Mapping.Customer, LOOKUP:Mapping.Product] each time you need to use it</P><P>It is important though to ensure that the same SUM or LOOKUP is not repeated within the line item formula. If it is, then it should be split in it's own line item; that way the formula is only performed once, not many times.</P><P>Also, I'm sure you know that you should avoid SUM and LOOKUP in the same [], as per Planual 2.02-08</P><P>I hope that helps</P><P>David</P>Fri, 11 Oct 2019 04:18:51 GMThttps://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52962#M8159DavidSmith2019-10-11T04:18:51ZRe: Order of Lookups and SUM in formulas
https://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52963#M8160
<P>Thanks David.</P><P> </P><P>And if besides the Lookups and SUMs, there is SELECT in some form as well (assuming best practice of not have SUM/LOOKUP together), would SELECT get some sort of preference?</P>Fri, 11 Oct 2019 04:26:54 GMThttps://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52963#M8160shreyak.garg2019-10-11T04:26:54ZRe: Order of Lookups and SUM in formulas
https://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52965#M8162
<P>SELECT and LOOKUP work in the same way, especially if the LOOKUP is based on a single value rather than multi dimensionally.</P><P>So in effect, you are "looking" up the value rather than "selecting" it, but it is a very similar construct</P><P>Make sense?</P><P>David</P>Fri, 11 Oct 2019 04:34:13 GMThttps://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52965#M8162DavidSmith2019-10-11T04:34:13ZRe: Order of Lookups and SUM in formulas
https://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52966#M8163
<P>Yes, makes sense. Thanks.</P><P> </P><P>I have always thought of LOOKUP to be more Module/Line Item centric and SELECT to be List/List item related.</P><P> </P><P>It is good to know that they work on the same principle.</P>Fri, 11 Oct 2019 04:40:01 GMThttps://community.anaplan.com/t5/Anaplan-Platform/Order-of-Lookups-and-SUM-in-formulas/m-p/52966#M8163shreyak.garg2019-10-11T04:40:01Z