Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Calculating totals for multiple columns

Avatar

Level 1

I want to add totals for two columns in a table and a final total with those two subtotals. I can not figure out how to do this and how to reference the rows and cells. Can someone please help? Thank you. Deepa

Add Totals to multiple columns.jpg

1 Accepted Solution

Avatar

Correct answer by
Level 10

Give a proper name for each Footer Row.. (For ex: FotterRow1, FooterRow2)..

Then your code will work without much complications.

Sum(FooterRow1.TotalA1 + FooterRow2.TotalA2)

Thanks

Srini

View solution in original post

7 Replies

Avatar

Level 10

You can try the following..

1) Keep the same name for all the amount fields in each column. (for example, first amount column field name is "Amount1" and second column field name is "Amount2").

2) Then write the code in the Calculate event of the Total field. (Use FormCalc)

     Total1.rawValue = Sum(Table1.Row1[*].Amount1);

3) Similarly for Second column

     Total2.rawValue = Sum(Table1.Row1[*].Amount2);

4) For the total of Amount1 and Amount2.

     LoanTotal = Sum(Total1.rawValue + Total2.rawValue);

Hope this helps.

Thanks

Srini

Avatar

Level 1

Thank you Srini for answering. Here is the formula that is working.

Field Name - TotalA1:

Sum(Table1.Row1.A1, Table1.Row2.A1, Table1.Row3.A1, Table1.Row4.A1, Table1.Row5.A1, Table1.Row6.A1, Table1.Row7.A1, Table1.Row8.A1, Table1.Row9.A1, Table1.Row10.A1);

Field Name - TotalA2:

Sum(Table1.Row1.A2, Table1.Row2.A2, Table1.Row3.A2, Table1.Row4.A2, Table1.Row5.A2, Table1.Row6.A2, Table1.Row7.A2, Table1.Row8.A2, Table1.Row9.A2, Table1.Row10.A2);

But this is not working

Field Name TotalLoanAmt:

Sum(FooterRow[0].TotalA1 + FooterRow[0].TotalA2)

Any idea how I can get the grand total working? Thank you. Deepa

Avatar

Level 10

The only issue I can think of is referencing the proper path.

Check the path of the field in the Heirarchy or in the Script Editor.

(or) Paste a screen shot of the heirarchy of the form to get a better understanding.

Try just "Sum(TotalA1 + TotalA2)" and see what happens..

Thanks

Srini

Avatar

Correct answer by
Level 10

Give a proper name for each Footer Row.. (For ex: FotterRow1, FooterRow2)..

Then your code will work without much complications.

Sum(FooterRow1.TotalA1 + FooterRow2.TotalA2)

Thanks

Srini

Avatar

Level 1

You are the best. Thank you so much. It is working now. DeepaTotals for two columns and grand total working.jpg

Avatar

Level 10

For the Amount fields set the Fonts to Right align to have a good look and feel..

Thanks

Srini