Showing results for 
Search instead for 
Did you mean: 
Helper V
Helper V

Filter Query and CSV


I have read the below:


My flow looks like the below.





There are two issues:


I want to first filter the data to be sent in the CSV file to only contain data on the last seven days for a column entitled “Current Contact Date” so for example if we have a date in that column of 26/12/2018 that will not get selected as the date for today is 04/01/2019, but a date of 31/12/2018 would.  At this time all data in the SharePoint list gets included which is understandable as I do not have filter in place.  I have tried adding in the filter query either of the following:


Current Contact Date with an expression of adddays(utcnow(),-7)




Current_x0020_Contact_x0020_Date with an expression of adddays(utcnow(),-7)


When I try to use ether of the above I get 400 error.


The second item is in the SharePoint list is a column entitled “source” which is a drop-down list.  When the CSV file is generated it shows in the column for that field the following:


{"@odata.type":"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference","Id":0,"Value":"General Data"}


I just want to show the “General Data" and not the rest is that possible do I need to be looking at a compose type action to strip the rest of this out before using the results of the compose in the CSV file creation. 


Any guidance would be appreciated.





Community Support
Community Support

Re: Filter Query and CSV



Do you want to send an email with items that are within a specific date time range?

What’s the column type of Source? Is it a Lookup column or Choice column?

I am not sure how did you input the function in the Filter query field, could you share a screenshot on it?

According to your description, I have made the following flow, please check it for a reference.

Add the button trigger. In your scenario, you could just change it to Recurrence.

Get items from SharePoint list. Input the following code in the Filter query field to filter out items that DueDate on the last seven days.

DueDate le ‘utcnow(‘yyyy-MM-dd’)’ and DueDate ge ‘formatDateTime(addDays(utcNow(),-7),'yyyy-MM-dd')’


Note: Please surround the functions with a single quote.

Then add the action Create SCSV table. Just set Include headers as Yes, and Columns as Custom. Then specify the headers and corresponding value.

Not sure the column type of Resource, so I added a Lookup column and a Choice column in the list. Then I selected dynamic content Lookup value and Choice value for each field.

Then send an email with the CSV table created in previous action. Please make sure enable Yes for Is HTML field.

Screenshots for your reference.


Hope the following doc on Filter query be helpful:


Best regards,


Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Helper V
Helper V

Re: Filter Query and CSV

Mabel @v-yamao-msft,


This is very helpful, and is giveing me lot of information on this fliter query, however I am still getting a 400 error, with the following:

The expression \"Current_x0200_Contact_x0200_Date le ‘2019-January-11’ and Current_x0200_Contact_x0200_Date ge '2019-Jan-07'\" is not valid.\r\nclientRequestId: 0b951e22-c581-4ebd-a1e5-3e122d2f4365\r\nserviceRequestId: 2b12b59e-90dd-7000-7224-7585a83389c7"
Okay so you mention "duedate" in your example above.  this did not work so i changed it to
Current_x0200_Contact_x0200_Date, or
Current_Contact_Date, or
Current Contact Date
This is the column I want to filter on for the last seven days of data and everytime I got a similar 400 error.  I modified the -days to see if the error was down to not having any data and still to no avail.
The flow worked perfectly with on Tuesday 08/01/2019 @ 20:00 and the person (external) receving the data got it and was happy to have it.
But at this time the filter is not working, do you have any further suggestions please.


Helpful resources


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021


Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (11,443)