Sum by Account starting with specific number




I have a List with accounts starting from 4* ,5* and 6*.


These accounts have some data value against them,I want to Sum up the data value by 4* ,5* and 6*.




Best Answer

  • DavidSmith
    Answer ✓


    An alternative (and simpler) approach (and this depends on how often the rules/categories will change)


    1. In your module dimensioned by Accounts (you should already have this), add a boolean formatted line item (e.g' "Prefix Check")

    2. Enter the formula: LEFT(CODE(ITEM(Accounts)))="4" OR LEFT(CODE(ITEM(Accounts)))="5" LEFT(CODE(ITEM(Accounts)))="6"

    3. Enter a new line item formatted as Accounts

    4. Enter the formula: IF Prefix Check then ITEM(Accounts) ELSE BLANK

    5. Then, as previously mentioned . you can use that line item as the SUM parameter


    If the rule in 2 starts getting more complex, or you need new rules, it would be better to start splitting the formula up


    I hope this helps



  • Hello Madhu,


    Can you have a Property as a line item in a module by the Account dimension for 4* ,5* and 6* to be classified into respective groups. Say Account category.  You could also use left(code(account),1) to determine them using a formula and assign the account category using a formula.


    Then you can sum it by "Account Category".




  • I think Arun has the correct solution, but to help you get there, Ill put it into steps:


    1) Create a module that has only the Account Dimension

    2) Create a text line item (Account Category Code) that creates the code of Account Category, as Arun suggested; left(code(item(account)),1) 

    3) Create  a line item to check whether it is the first occurrence ISFIRSTOCCURRENCE(Account Category Code, Account)

    4) Filter on the isfirstoccurrence and save the view for import.

    5) Create the list Account Category

    6) Import the saved view into Account Category

    7) Add the import to the process where you update Accounts, to make sure any new category is always added.

    😎 Add a property formatted as Account Category to the Account list with the formula: FINDITEM(Account Category,  left(code(item(account)),1)) 


    You can now sum over Account Category when it is in the dimension of the module with ...[SUM: Account.Account Category]





    Bram Kurstjens

  • This will only work if you want to sum up all accounts that are in 4, 5 and 6 and not sum them seperately per account category. If you want to sum them seperately you would need line item per category. Then if you want to show these figures in different modules, you would need to create 3 additional line items per value you want to show. Moreover, even though my suggestion (/Arun's) requires more time now, it will not require additional time when categories change. So which you implement really depends on what you want to do with it in the end.

  • Agreed, I was just showing some alternative methodologies


    As you say, "it depends"