Grand total at the last row of a table in Perspective table

I want to show the grand total of all the columns in the last row of the Perspective Table.
I have binded the table data with named query.
here is the example:

Please guide

Thank you

Add another script transform where you load the data
Then sum one of the rows, then create a new row(in your case you'll need 3 columns in the new row, I got 2 in the example.
Then the addRow function adds the new row at the bottom

NewSummedData= sum(value.getColumnAsList(1)) 
|newRow = [Summed Values,NewSummedData]
newdataset = system.dataset.addRow(value,newRow)
return newdataset

1 Like

Thank you

sorry but exactly I am not getting. this table I want to show on load page.

Do you have a sample of the data you can share?

Well, I was kind of hoping for the dataset, since that is what will be manipulated. :wink:

sorry I didn't get it. is this is what your asking (8.3 KB)

A copy of the dataset that populates this table. This is the one that you are looking for totals, correct? Also, do you need the shift totals, as well? as per your first post?

yes I want total of TargetPerMonth column and actualYield column ie. 2nd and 3rd column
last row I want to display total.

The error you are seeing is because your new row does not have the same number of columns.

targetPerMonthSum = sum(value.getColumnAsList(1)) 
actualYieldSum = sum(value.getColumnAsList(2))
newRow = ['Total', targetPerMonthSum, actualYieldSum]
newdataset = system.dataset.addRow(value,newRow)
return newdataset

yes I am getting. I didn't have any idea of using Add Transform, need to learn lot in perspective.

Thank you Thank you so much. This is what I exactly I wanted.