Adding rows values into new column using linq

Hi @Suma1993

You have used the vb code in the Invoke code activity in the above post right, Remove that code in Invoke code activity give the below one,

' Initialize the output DataTable
Dim outputDt As New DataTable
outputDt.Columns.Add("Date")

' Get distinct Invoice Dates to use as columns
Dim invoiceDates = inputDt.AsEnumerable().Select(Function(row) row("Invoice Date").ToString()).Distinct().ToList()

' Add columns for each distinct Invoice Date
For Each dateStr In invoiceDates
    outputDt.Columns.Add(dateStr)
Next

' Add Total column
outputDt.Columns.Add("Total", GetType(Integer))

' Get distinct Dates to use as rows
Dim dates = inputDt.AsEnumerable().Select(Function(row) row("Date").ToString()).Distinct().ToList()

' Populate the output DataTable
For Each dateStr In dates
    Dim newRow As DataRow = outputDt.NewRow()
    newRow("Date") = dateStr
    
    Dim totalRowAmount As Integer = 0
    
    For Each invoiceDate In invoiceDates
        Dim totalAmount = inputDt.AsEnumerable().
            Where(Function(row) row("Date").ToString() = dateStr AndAlso row("Invoice Date").ToString() = invoiceDate).
            Sum(Function(row) Convert.ToInt32(row("Net Amount")))
        If totalAmount > 0 Then
            newRow(invoiceDate) = totalAmount
            totalRowAmount += totalAmount
        End If
    Next
    
    newRow("Total") = totalRowAmount
    
    outputDt.Rows.Add(newRow)
Next

' Assign the result to the output argument
Output_dt = outputDt

→ The Arguments and flow is same.

Check the below excel output for better understanding,
image

Hope it helps!!