OEG Best Practice: Dimension order
Dimension order affects calculation performance
Ensuring consistency in the order of dimensions will help improve the performance of your models. This consistency is relevant for modules and individual line items. Why does the order matter? Anaplan creates and uses indexes to perform calculations. Each cell in a module where dimensions intersect is given an index number.
Here are two simple modules dimensioned by Customer and Product. In the first module, Product comes first and Customer second, and in the second module, Customer is first and Product is second.
In this model, there is a third module that calculates revenue as Prices * Volumes.
Anaplan assigns indexes to the intersections in the module. Here are the index values for the two modules. Note that some of the intersections are indexed the same for both modules: Customer 1 and Product 1, Customer 2 and Product 2, and Customer 3 and Product 3, and that the remainder of the cells has a different index number. Customer 1 and Product 2 is indexed with the value of 4 in the top module and the value of 2 in the bottom module.
The calculation is Revenue = Price * Volume.
To run the calculation, Anaplan performs the following operations by matching the index values from the two modules.
Since the index values are not aligned, the processor scans the index values to find a match before performing the calculation.
When the dimensions in the module are reordered, these are the index values:
The index values for each of the modules are now aligned. As the line-items of the same dimensional structure have an identical layout, the data is laid out linearly in memory. The calculation process accesses memory in a completely linear and predictable way. Anaplan’s microprocessors and memory sub-systems are optimized to recognize this pattern of access and to pre-emptively fetch the required data.
How does the dimension order become different between modules? When you build a module, Anaplan uses the order that you drag the lists onto the Create Module dialog. The order is also dependent on where the lists are added. The lists that you add to the 'pages' area are first, then the lists that you add to the 'rows' area, and finally the lists added to the 'columns' area.
It is simple to re-order the lists and ensure consistency. Follow these steps:
- On the Modules pane, (Model Settings>Modules) look for lists that are out of order in the Applies To column. Click the Applies To row that you want to re-order, then click the ellipsis.
- In the Select Lists dialog, click OK.
- In the Confirm dialog, click OK.
- The lists will be in the order that they appear in General Lists.
- When you have completed checking the list order in the modules, click the Line Items tab and check the line items. Follow steps 1 through 3 to re-order the lists.
Subsets and line item subsets
One word of caution about Subsets and Line Item subsets. In the example below, we have added a subset and a Line Item Subset to the module:
The Applies To is as follows:
Clicking on the ellipsis, the dimensions are re-ordered to:
The general lists are listed in order first, followed by subsets and then line item subsets.
You still can reorder the dimensions by double-clicking in the Applies to column and manually copying or typing the dimensions in the correct order.
Largest vs. smallest?
This is the normal follow up question, and unfortunately, the answer is "it depends." Through research we have found that it all depends on the data within the module. Also, it can get very confusing if subsets are used; the Customer list might be bigger than the Products list, but if a subset of Customers is used that is smaller than Products, then what?
Also, we don't advocate ordering the lists in the General Lists setting in size order; the lists should be ordered in hierarchical order top to bottom, so, by definition, that will be smallest to largest. So our advice is be consistent. Think about how you describe the problem. Does the business talk about Customer by Product, or Products for Customers? Agree to a convention, and stick to it.
Other dimensions
The calculation performance only relates to the common lists between the source(s) and the target. The order of separate lists in one or other doesn’t have any bearing on the calculation speed.
Author David Smith.
Comments
-
Cool post! Great insights for performance tuning!
1 -
Got lots more of this sort of thing to come - Keep watching!
0 -
thanks for the simple, elegant, powerful explanation.
2 -
I have 2 questions here:
1. It is mentioned here that Anaplan remembers the sequence of adding the lists. Is there any specific reason / advantage to save this sequence?
2. Isn't it possible for Anaplan to sort this based on the order provided in General List (instead of asking modeller to manually clicking the ellipsis & then click OK)? In fact, I observed that Anaplan itself sorts the lists based on order of General List when I click ellipsis & select the lists under Blueprint --> Applies to.
0 -
There is no advantage or disadvantage of the "ordering" as such and have had discussions internally about automatically re-sorting list. What I would say is the consistency of the ordering is actually more critical than which comes first. I would always advocate ordering the modules in the way you think about or describe the business and be consistent. This may be different to how you have ordered the lists in the General lists, It is also worth pointing out that any views of the module (including the default view) are not impacted by the ordering in the Applies setting. It is worth adding a request to the ideas exchange if this is something of high importance to you
I hope that helps
David
3 -
Thank you David!
0 -
Thanks David! following up on your example, does it make a difference if one dimension (product) is way bigger than the other? I think I remember to put them in the smaller to larger order (and keep the consistency across module as you indicated), but was not sure if that makes a difference or not.
0 -
Great David. Follow on question: please layer in how properties are handled in terms of indexing and ording of lists.
Thanks.
0 -
@guillaume_arnau Good question and one we have been asked previously.
The evidence is not as conclusive as the consistency as the answers depended on how much dtaa was in the modules. Sometimes smaller to larger was faster and other times larger to smaller was faster.
You then start to faxctor in subsets and it gets more complicated. If in doubt, it is worth trying it and seeing if there is a noticable difference
So, the consistency of the ordering is actually more critical than which comes first. I would always advocate ordering the modules in the way you think about or describe the business and be consistent. This may be different to how you have ordered the lists in the General lists
@dkolka List properties ARE effectively line items so there is no difference. However, we don't advocate using them unless essential. It is best practice to use Modules and line items rather than list properties
1 -
Very helpful and actionable - thanks @DavidSmith !
0 -
Very powerful and useful tips, please keep them coming and updating the Planual 😉
0 -
@DavidSmith - in the Subsets and Line Item Subsets section, you note how Anaplan will auto-reorder based on General Lists then Subsets then LIS.
Because Subsets are often created at different times in development, it is difficult to keep them ordered consistently with how their primary list is ordered within the General Lists. So if, for example, you have a module with 2 list subsets:
- A: Subset
- B:Subset
But when clicking the ellipsis in the Applies To, the model dimensions show up in this order:
- A
- B
- B:Subset
- A:Subset
So the Applies To is then naturally reordered to be: B:Subset, A:Subset
So my question is: is it best practice to always manually cut/paste List Subset dimensions so that their order is aligned to the order of their corresponding general lists? And doing so will have a positive performance impact?
Thanks!
0 -
Short answer is yes.
Having the subset in the correct corresponding order will give a performance benefit. A subset is treated as a list for the calculations
We advocate a regular "tidy-up" of the dimension order to double check. It is also a reason why I shy away from subsidiary views - If you don't have any, it is easy to do the tidy-up/check from the module blueprint as you don't have to check individual line items
Hope that helps
David
2 -
Are there any time studies for sorting dimensions in the Applies To?
I'm sure the answer is "it depends", but are there any baseline studies shows that sorting increases calculations performance by "x" percent? Or reduces calculation time by "y" seconds?
1 -
Very informative!
0 -
Just picking up this thread based on the recent addition of User list subsets.
in terms of ordering, should these be ordered as per the User list itself, or should it be ordered as the last subset?1