Summarizing data table rows based on specific column using C#

  • Thread starter Thread starter Mohammad Nadeem Alam
  • Start date Start date
M

Mohammad Nadeem Alam

Guest
Hi Everyone,
I need a logic to implement for the below.
I have a C# console application. In that, I am generating Journal, which is in the form of data table. I am finally writing into a file in a csv format. I am able to do that.
In data table, I have numbers of rows as shown below. I need to summarize the rows based on Debit and Credit column for other column same data. Suppose I have 100 rows in the data table in which text1 is 20 times, 10 times with Debit columns values and 10 times with credit columns values. Therefore, for those 20 rows, I need to summarize 1 rows for credit 1 rows for debit. Value in credit and debit will be added respectively.
Let us take an example as below

Year


Entity


Account


CostCenter


Currency


BusUnit


Debit


Credit


Text


Date


2020


40001


80111




AED


101


100




Salaries Feb 29 - HO Overheads


29/02/2020


2020


40001


17891




AED


101




100


Salaries Feb 29 - HO Overheads


29/02/2020


2020


40001


80111




AED


101


200




Salaries Feb 29 - HO Overheads


29/02/2020


2020


40001


17891




AED


101




200


Salaries Feb 29 - HO Overheads


29/02/2020


2020


40001


80111




AED


101


300




Salaries Feb 29 - HO Overheads


29/02/2020


2020


40001


17891




AED


101




300


Salaries Feb 29 - HO Overheads


29/02/2020


2020


40001


12122




AED


201


250




Salaries - Feb 2020


29/02/2020


2020


40001


22222




AED


201




250


Salaries - Feb 2020


29/02/2020


2020


40001


12122




AED


201


350




Salaries - Feb 2020


29/02/2020


2020


40001


22222




AED


201




350


Salaries - Feb 2020


29/02/2020


2020


40001


323232




AED


301


500




Salaries Feb 29 - abcd project


29/02/2020


2020


40001


131313




AED


301




500


Salaries Feb 29 - abcd project


29/02/2020


2020


40001


323232




AED


301


100




Salaries Feb 29 - abcd project


29/02/2020


2020


40001


131313




AED


301




100


Salaries Feb 29 - abcd project


29/02/2020


2020


40001


323232




AED


301


200




Salaries Feb 29 - abcd project


29/02/2020


2020


40001


131313




AED


301




200


Salaries Feb 29 - abcd project


29/02/2020


output should be as below.

Mohammad Nadeem Alam SME in Emirates NBD

Continue reading...
 
Back
Top