2.02-10 Using PREVIOUS() vs CUMULATE()
For long timescales, using PREVIOUS is faster than CUMULATE due to the number of "reads" required for the calculation. So, the expression should be: 'Calc line item' = 'data line item' + PREVIOUS('Calc line item') rather than CUMULATE('data line item')
2.02-10a Short Timescales: Where the number of periods is small, Cumulate is faster
Best Practice article:
Performance Issues with Cumulate Over Lists
Rule 2.02-10 Using PREVIOUS vs CUMULATE. For long timescales, using PREVIOUS is faster than CUMULATE due to the number of "reads" required for the calculation. So, the expression should be: 'Calc line item' = 'data line item' + PREVIOUS('Calc line item') rather than CUMULATE('data line item'). It goes against PERFORMANCE elements of PLANS if you wish to go against this rule
Here is how it was done in Pre Planual Era: In order to aggregate the data across the timescale we used to use CUMULATE function to do so. Here the timescale is weekly, multiple years
What is wrong with this method? CUMULATE impacts the performance due to the number of “reads” required.
Exception 2.02-10a Short Timescales: You should use CUMULATE only when the timescale is small. Preferably a Monthly Time Period of 1-2 Years
Here is how it should be done in Planual Way: You can get the same result by using PREVIOUS instead of CUMULATE.
One thing to note is that PREVIOUS works only on Time Periods and doesn’t work on Lists whereas CUMULATE works on both.
When using CUMULATE over a list—this is when using the format CUMULATE (x, y, z)—the performance can be poor with anything that exceeds a few million cells. This is because the function is running on a single CPU thread, which differs from nearly all Anaplan functions. Anaplan gets its efficiency from high levels of concurrent multithreading on the CPU, which is where a calculation is broken down into many smaller tasks that can run in parallel, so it can run much faster.
Here’s a simple example to illustrate.
Fig. A shows a 10-second calculation running on a single thread.
Fig. B shows the same calculation split into 10 smaller tasks, so it only takes one second to run. Anaplan servers can use over 100 threads to improve efficiency like this.
- Planual Conventions
- Zen of Anaplan
- Chapter 1 - Central Library
- Users and Roles
- Line Item Subsets
- Chapter 2 - Engine
- Line Items
- Saved Views
- Chapter 3 - UX Principles
- Hierarchy of Information
- Smart Grouping
- Reduce Visual Load
- Progressive Disclosure
- Use Consistency and Standards
- Provide Help and Guidance
- Use The Correct Data Type
- Give Users Visibility Into Status
- Match With Real World Scenarios
- Check In With End Uses Frequently
- Chapter 4 - UX Build
- Chapter 5 - Integration
- Source Models
- Import Data Sources
- Data Hub
- Chapter 6 - Application Lifecycle Management
- Revision Tags
- Production Lists
- Deployed Mode
- Managing Changes During Development
- Chapter 7 - Extensions