When you read items from a SharePoint list and you want to filter by calculated fields in that list filter queries will fail. So how can you filter your items?

A SharePoint list with a calculated field

In SharePoint I’ve created a list with a calculated column. These calculations can become quite complicated and sometimes you might just want to create a flow that does the calculations for you.

There are however plenty of reason to create calculated columns. In my example I’m using the created column to calculate tomorrow.

Filter by calculated fields in SharePoint using Power Automate
Filter by calculated fields in SharePoint using Power Automate 1

Then as i create items in my list I see that Tomorrow has been set to tomorrow’s date.

Filter by calculated fields in SharePoint using Power Automate
Filter by calculated fields in SharePoint using Power Automate 2

Get Items from SharePoint

When you use the experimental filter query option you will see that the calculated columns aren’t listed in the drop down and also when you use the GA version of the same things will not be much better

Filter by calculated fields in SharePoint using Power Automate
Filter by calculated fields in SharePoint using Power Automate 3

When you configure the query with add a custom item in the above action, then you will see the following error when you run the flow:

The field ‘Tomorrow’ of type ‘Calculated’ cannot be used in the query filter expression.

Filter by calculated fields in SharePoint using Power Automate
Filter by calculated fields in SharePoint using Power Automate 4

Filter by calculated fields

So that means that we can’t filter the items during the get items action and we will need an additional filter action added to our flow.

Filter by calculated fields
Filter by calculated fields in SharePoint using Power Automate 5

Condition Left: formatDateTime(item()?[‘Tomorrow’], ‘d’)

Condition right: formatDateTime(AddDays(utcNow(), 1), ‘d’)

When we run the flow with this additional fitler action, the flow is successful and we managed to filter by calculated fields in SharePoint.

Filter by calculated fields in SharePoint using Power Automate
Filter by calculated fields in SharePoint using Power Automate 6

Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

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://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://sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@sharepains.com

Related Posts

2 thoughts on “Filter by calculated fields in SharePoint using Power Automate

  1. Genius! Thank you for posting this solution. The inability to filter query on calculated fields is a real headache.

Leave a Reply

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

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading