How to filter the data and add them


May I know how did you do the pivot?



This is how it looks

BlankProcess - Copy (13).zip (12.7 KB)

check the updatedep.xaml

Hope this helps


no not like this.Outpt should fill in sheet2 which i have send sample output layout
Book1.xlsx (11.0 KB)


You already crwated a pivot what else do you need now?


the resulted values should be enter into the sheet2
In this blanks, the sum values should be filled


So you need sum of eqch department salary for each state?

If so then create the pivot accordinngly…

Apart from that you can filter based on state and then use the code gicen by me and write the data as needed


Hi @anjani_priya ,

Could you maybe check with the below workflow : (11.9 KB)

We are preparing the Output Datatable by adding the required columns needed (Unique Branch Values).

We are then using the Unique Branches values to prepare the Output Datatable after Grouping based on Department.
Below is the Linq Expression used :

OutputDT = (From d In DT.AsEnumerable
Group d By k=d("dept").toString.ToUpper.Trim Into grp=Group
Let arrRow = uniqueBranches.Select(Function(x)CObj(Math.Round(grp.Where(Function(y)y("BRANCH").ToString.Equals(x)).Sum(Function(y)CDbl(y("salary").ToString)),2))).ToArray
Let updatedRow = {CObj(k)}.Concat(arrRow).ToArray
Select OutputDT.Rows.Add(updatedRow)).CopyToDatatable

Here, uniqueBranches is of the type Array of String where it contains the unique branch values.

Below is used to get the Unique Branch values :

uniqueBranches = DT.AsEnumerable.Select(Function(x)x("BRANCH").ToString).Distinct.ToArray
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.