Hi folks,
I have gathered data from an Excel worksheet to a data table. This contains four columns, one of which is “Amount”. The goal is to consolidate the amount values in the table, based on the values found in the other cells of the row. These amounts are monetary amounts, e.g. 123.00.
So if there are three rows containing information of a certain customers transactions, a final datatable will show this customer only in one row, with the three Amount values tallied.
This is done using DataTable.Compute as outlined here: Consolidate Rows in Data Table
As the data is taken from Excel, I have converted the (currency) values in the “Amount” column from string to decimal using a loop through each row, and an assign activity as pictured (Image 1)
A new datatable is created consolidating the rows, where the values in the other three columns match (image 2). And a new “Amount” column is added to this new datatable using AddDataColumn, with Type of System.Decimal
Lastly, we loop through this new consolidated datatable, using datatable.compute, attempting to sum the amount columns based on a filter of one of the other columns. (Image 3)
However, this exception is thrown at this stage:
Invalid usage of aggregate function Sun() and type: Object.
Any assistance? I have struggled with various fixes over the past two days and I’ve reached a point of frustration.