Hello Friends
i have a case i which i need to aggregate the dates based on the max date as per the below
Any suggestions
Hello Friends
i have a case i which i need to aggregate the dates based on the max date as per the below
Any suggestions
group the data on the first column (containing A, B…) as described here:
from the group take that row the max date. The max date can be found e.g. by a sorting. For comparing the dates e.g. a parsing with dateTime.ParseExact(… will help
Thanks for your reply.
Can u support in this, as iam not so familiar with LINQ
Thanks in advance
give a try on following
Assign activity:
left side: dtGrouped - Datatype: DataTable
right side: YourDatatableVar.Clone
Assign activity:
left side: dtGrouped - Datatype: DataTable
(From d in YourDatatableVar.AsEnumerable
Group d by k=d(0).toString.Trim into grp=Group
let mdt = grp.OrderBy(Function (x) CDate(x(1).toString)).Last()(1)
let ra = new Object(){k, mdt}
Select dtGrouped.Rows.Add(ra)).CopyToDataTable
@ppr - Sorry , not try to hijack this post…I didn’t get the expected Result(Output shown below)…Am I missing something?
My Dt Setup
@prasath17
Many thanks for this cross check I did update the statement
let mdt = grp.OrderBy(Function (x) CDate(x(1).toString)).Last()(1)
bold part was ommited - we want to fetch the col value.
Thanks for cross checking and enhancement
GroupBy_1Col_TakeLastMonth.xaml (7.5 KB)
the original data was without leading 0 in the month part but both are working
@ppr - Awesome …It worked…Thanks again…
Learning the LINQ truly from your forum replies and from the tutorials…
Thank my friend it worked
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.