Not able to filter column with latest date

I have a column which has multiple dates & I want to pick up the latest date results , I am using the below query but it is not giving me the correct result:
DT.AsEnumerable().Where(Function(r) r(“Process Date (latest image)”).ToString = ([DT].AsEnumerable().Max(Function (drRows) drRows(“Process Date (latest image)”).ToString))).CopyToDataTable
Please find below the sample data:

Process Date (latest image)
09/11/2020
09/11/2020
09/11/2020
05/03/2021
05/03/2021

Hi @Yoichi ,

Any help from your end would be really appreciated!

Hi,

Perhaps you should compare them as DateTime. For now, can you try the following expression?

DT.AsEnumerable().Where(Function(r) DateTime.Parse(r("Process Date (latest image)").ToString) = ([DT].AsEnumerable().Max(Function(drRows) DateTime.Parse(drRows("Process Date (latest image)").ToString)))).CopyToDataTable

Regards,

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