Filter SharePoint list items without a date in Power Automate

Filter items without a date

Filter SharePoint list items without a date in Power Automate

By:

Date:

So you have a list and that list has a date field. Now you only want to get the items that have a date set and filter out the items without a date.

SharePoint date field

This problem could for example appear in tasks lists where some tasks have a due date set.

In my example, the SharePoint date field in a list can be empty. My first date is on 23 March. The second date is on the 25th and my 3rd date is just empty.

Filter SharePoint list items without a date in Power Automate

Using a filter Query using a null expression

Now we could use the null value expression like this:

Filter SharePoint list items without a date in Power Automate

But when you run this flow we will see the following error:

The expression “Date ne” is not valid. Creating query failed.

Filter SharePoint list items without a date in Power Automate

Using a null value again to filter items without a date

There is however a way that we can make filtering without a date work.

Using a null value again to filter items without a date

Date ne null as a Filter query expression does work?

Why?

Well the null expression will resolve as nothing and therefore the Date ne is being past to the underlying SharePoint API.

When we use Date ne null we will send exactly that to the filter expression used by the SharePoint REST API and the null value is now used to filter against.

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There’s a better way — and I can show you exactly what it looks like. I’m the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I’ve been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://staging.sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/ Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://staging.sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@staging.sharepains.com

Tags:

3 responses to “Filter SharePoint list items without a date in Power Automate”

  1. Kay Avatar
    Kay

    Dear Mr. Veenstra
    hartelijk bedankt for this blog post.
    I was fighting with this very issues for weeks now – and had tried various approaches, but not thought of often simple is the best!

    1. Pieter Veenstra Avatar

      Hi Kay,

      You are more than welcome!

  2. Anne Toal Avatar
    Anne Toal

    Thank you Pieter. Very helpful.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.