Sum based on attribute of input

New Contributor

Sum based on attribute of input

Hi All,


I am a beginner in Anaplan, just finished my training course and started building my first model. What I am trying to achieve here is to sum a column (input) based on each record's category (another input, formatted as list created previously). 


For instance, This is my input:

Value   Category

100         A

200         B

500         A

50           C

65           B


Note that I have created a list called category, and there are three items in that list (A B C).

I put the category in the page dimension so I can toggle. I did not have a line item called category.


What I would like to achieve is to add a total value column to show the total column of that category when I toggle that category.

Category: A


Value  Total-value

100         600

500         600


How can I achieve this? I tried Value[sum:Category] but it says it is not a line item. Should i create a property in the category list so i can use it in the formula?


Thank you so much!


Community Boss

Re: Sum based on attribute of input



you are correct this is the classic SUM usage. You probably did a slight mistake. here's how it should be:

Your "Data" source module should have two line items: Value and Category and a "transaction" dimension (1,2,3,4, etc) to make the rows. it seems you have this already.

Now in your target module you can have a line item called "SUM" and the category list as a dimension. The formula of this line item should be: Data.Value[SUM:Data.category]

This will give you the sum of the category you select


This is essentially what you have done so just be careful to what you write as the SUM parameter: it must be a line item in a source module, not a list name, formatted as the dimension you want to SUM on in your target module.

Nathan Rudman, Anaplan Model Builder