# Sum based on Boolean

Options

Hello,

Hopefully a simple one.

Our P&L has 50 cost centres, each of which have staff costs assigned.

In a separate module I want to bring in the staff costs from 15 of these - is there a simple way to do this, for instance by having a separate module with the cost centres included and a boolean line item to determine which to include in the sum?

Thanks!

• Options

Hello @motorwaygn ,

Once you have the boolean, could you have a list formatted line item with the cost centres and an if statement in a system module, where if the boolean is true it results in the item and if not, it is blank?

Once you have that, you would be basically using only the cost centres that you want to use?

Hope that helped!

Kind regards,

Bruno Rodriguez

• Options

That's actually exactly what I did, but the formula was breaking saying there wasn't a common dimension.

• Options

How was it being applied?

Kind regards,

Bruno Rodriguez

• Options

Hi @motorwaygn ,

Based on boolean check, you can filter down cost centres that you want to sum (as @BrunoRodriguez suggested), or even the costs that make up to the sum (by using a new lineitem in module1 that goes like 'if boolean check then cost else zero')

But to bring the sum to second module, what is the dimensionality of this second module (target module), where you want to show sum of 15 cost centres? And is there a relation between that dimension and the cost centre dimension?

If there is a relation, you might use SUM. But if not, you may have to use a different workaround like a select on top level of cost centres.

• Options

Hello again,

Thinking about it again, I think we have to differenciate how you are going to aggregate the data:

1. You have your data sets per Cost centre - list 1 - in Module A
2. You create your mapping in System Module B
3. The list formatted line item used in Module B, needs to be dimension by List 2
4. The target module where you aggregate the data from Module A, needs to have List 2 included as applies to rather than list 1.

I hope the above makes sense.

Cheers!

Kind regards,

Bruno Rodriguez

• Options

Sharing a method which works for me. This is tried and tested.

1. First create the "system modules" of each of the dimension you want to boolean. You need only 1 line item in each sys module as boolean formatted and no formula in it. Let the user select the boolean
2. Now, in the target module, the formula starts with

IF

SYS Module1. Boolean OR SYS Module2. Boolean OR SYS Module1. Boolean OR SYS Module1. Boolean

THEN