How to Filter Two or More Items from a columns in Datatable

Sample_Data.xlsx (15.3 KB)
@Suraj_B_Shetty see this attachment.

@Suraj_B_Shetty ignore CALISUN and use the ones you see in the sample data. Thanks!

Hi @Sisay_Dinku

In the sample file which u shared, only “PACIFIC SUNWEAR OF CALIFORNIA” has line items with start date “01/04/2023”. Thats why you are able to see only that line item. Modify the input and verify with the same code.

Hope this helps

@Suraj_B_Shetty Thank you so much. That’s a silly mistake. If I have to make it the whole month of April, how do I do that in the date part? Thanks!

@Sisay_Dinku

Give a try to this

dt_input.AsEnumerable.where(function(x) (x(“Customer Name”).ToString.Equals(“PACIFIC SUNWEAR OF CALIFORNIA”) Or x(“Customer Name”).ToString.Equals(“CALISUN”)) And x(“Warehouse Id”).ToString.Equals(“09”) Andalso DateTime.parseExact(x(“Start Dt”).ToString,“MM/dd/yyyy 00:00:00”,system.Globalization.CultureInfo.InvariantCulture).ToString(“MM”).Equals(“04”)).CopyToDataTable

Or

dt_input.AsEnumerable.where(function(x) (x(“Customer Name”).ToString.Equals(“PACIFIC SUNWEAR OF CALIFORNIA”) Or x(“Customer Name”).ToString.Equals(“CALISUN”)) And x(“Warehouse Id”).ToString.Equals(“09”) Andalso DateTime.parseExact(x(“Start Dt”).ToString,“MM/dd/yyyy 00:00:00”,system.Globalization.CultureInfo.InvariantCulture).ToString(“MMMM”).Equals(“April”)).CopyToDataTable

Hope this helps.

1 Like

@Suraj_B_Shetty Much appreciation. That worked perfectly fine. Thank you so much!!

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