cancel
Showing results for 
Search instead for 
Did you mean: 

Calculate a product line by line

Former Member
0 Kudos

Hello all,

how can I calculate a product of two key datas line by line? The default is column by column but in this case I get a incorrect result.

Here is an example what I mean:

Table 1:

Month.........Type...... Distance(km)......Weight(kg).........Distance * Weight

Jan.............Typ_1.............2..........................10...........................20

Jan.............Typ_2.............5..........................20.........................100

Jan.............Typ_3.............4..........................10...........................40

Sum............................................................................................160 <-- correct Sum

When I list the key datas only for month I get a different sum(see Table 2)

How can I get the information in Table 2 with the correct sum of Table 1 ?

Can you help me to fix the problem ?

Table 2:

Month.......Distance (km)....... Weight (kg).................. Distance * Weight

Jan...................11...........................40...............................440 <-- incorrect Sum

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You have to make use of calculation context functions like 'ForEach' and 'ForAll' to calculate the sum here.

In the second table, you don't have a product dimension, but you want to calculate it by product dimension. So use ForEach function to include the product dimension in the calculation. Create a new variable and use this function to calculate the sum. If you need more details BO help is one good place where you can find information on these calculation contexts or just google up :).

Please let me know if you need anymore information.

Regards,

Sanjay

Former Member
0 Kudos

Hello,

thank you for your answer and your explanation

The sum in the second table is correct now and it works fine - thanks !!

Answers (0)