Conditional logic: Does a list item appear in a subset?
Subsets are invaluable in creating dynamic and efficient models in Anaplan. They are typically used as a dimension in a module, where only the subset is relevant.
Take, for example, a list named Employee containing a list of all employees in your organization. Employees are either Sales Executives or Engineers:
A module for holding sales quotas by employee would use the Sales Executive subset as the module dimension. This is logically correct, ensuring that sales quotas are not inadvertently stored for Engineers. Moreover, this helps to manage the model size by ensuring redundant data (i.e. sales quotas for Engineers) is not stored.
The challenge comes when you want to use conditional logic in a line item and use a formula that produces a different result depending on whether a list item appears within a subset or not.
In our example, let’s say we’re modeling headcount expenses by employee and all Sales Executives receive a car allowance of $10,000 per annum. We need a way of determining whether an employee is in the Sales Executive subset or not.
There is no standard Anaplan formula to achieve that, but the screenshot below shows how to achieve this. Please note the following:
- We calculate two Boolean line items – is Sales Executive? And is Engineer?
- These are line items in the Employee Details SYS module. Note—this is best practice, in contrast to storing the results as properties of the list.
- While the module is dimensioned on Employee, the Applies To field of each line item is set to the corresponding subset
- Each line item is hard-coded to TRUE, which, mixed with the Applies To restriction on the subset, ensures that only items in that subset are set to TRUE
You can see from the screenshot below that the Booleans calculate correctly, showing which subset for which each employee is a member.
You can then go on to refer to the two Boolean line items in this Employee module in the normal way. In the following screenshot, we are referring to the is Sales Executive? Boolean in a calculation module where we are calculating car allowance. Only sales executives should receive a car allowance of $10,000 per month:
We can now see that only our sales execs are receiving a car allowance: