Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate combining several columns using restrictions?

Hi,

I am trying to solve a data problem. I need to create a formula that takes the sum (based on column A) of "to X" value minus the corresponding value in "balance" for X. The similar will apply for the "to Y". Another restriction is that variables in column "C" will differ, so there must be a restriction for this as well.

ABCBalanceTo XTo YTO ALLOCATE XTO ALLOCATE Y
1XZ508.9812.41496.57
1YZ12,334.00300.8312,033.17-195.74195.74
2XZ492.5912.01480.58
2YZ21,118.62515.0920,603.5334.51-34.51


The two last columns "TO ALLOCATE X" and "TO ALLOCATE Y" shows the numbers that I would like to achieve.

Can anyone please help me with this issue?

Thanks,

Johanna

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try with this expression

    To Allocate X =Sum(TOTAL <A> [To X])-Aggr(Sum( {<B={'X'}>}Balance),A)

    To Allocate Y=Sum(TOTAL <A> [To X])-Aggr(Sum( {<B={'Y'}>}Balance),A)

Hope it helps

Celambarasan

View solution in original post

7 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Can you explain again how you achieve your desired result please?  I can't work out how you got to -195.74, for example.

Thanks,

Jason

Not applicable
Author

Hi,

In order to get -195.74 I do 12.41+300.83-508.98. For Y I get 195.74 I do 496.57+12,033.17-12,334.

Thanks,

Johanna

Not applicable
Author

Something like this?

Not applicable
Author

Hi,

Is it possible to send the expression instead? I don’t have a full license (yet), so I cannot open your file.

Thanks!

Not applicable
Author

I use a straight table with "A" as dimension.

To Allocate x: =Sum([To X]) - Sum({<B = {'X'}>}Balance)

To Allocate y: =Sum([To Y]) - Sum({<B = {'Y'}>}Balance)

Not applicable
Author

Hi,

Thanks for this, but the thing is that I need to have all columns that indicated in the first posting. Any ideas how to solve this?

Thanks,

Johanna

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try with this expression

    To Allocate X =Sum(TOTAL <A> [To X])-Aggr(Sum( {<B={'X'}>}Balance),A)

    To Allocate Y=Sum(TOTAL <A> [To X])-Aggr(Sum( {<B={'Y'}>}Balance),A)

Hope it helps

Celambarasan