“I need to use calculated column in a filter but Power Automate always returns Action ‘Get_items’ failed”
“The field ‘MyField’ of type ‘Calculated’ cannot be used in the query filter expression.”
As the error message tells you, in Power Automate you can’t use calculated columns in the Get items’ Filter Query, no matter how hard you try. It is a simple query that can compare only columns with a static value, calculated fields with their dynamic values depending on multiple columns are not supported. Are there any workarounds then?
It depends on what type of formula are you using in the calculated column.
Comparison between multiple columns
There’s no workaround, the filter can’t compare one column with another. It needs a single column compared to a specific value.
Date operations using multiple columns
=DATEDIF([Column1], [Column2], "d")
Again, no workaround as there’s no specific value to compare with.
Mathematical operations using multiple columns
Text operations with multiple columns
=CONCATENATE([Column1], " ", [Column2])
Finally something (unless you need to use the text columns in a logical operation, that would be again not possible). If you’re using the calculated column to build a string, you can split it into multiple pieces in the filter. Instead of :
CalculatedColumn eq 'Number One'
Column1 eq 'Number' and Column2 eq 'One'.
Operations using just one column
=[Column1]+3 or =IF([Column1]="Number One", "OK", "Not OK")
These can be rewritten into the filter. When you look on it, the formula contains only a single column and a specific value:
Column1 eq '<value-3>' or Column1 eq 'Number One'
There’s also possibility to skip the Filter Query in the Get items / Get files action, get all items from a list / library and implement the filter (incl. formulas with multiple columns) later in the flow using IF conditions. I’d avoid such approach as such flows are slow, difficult to test and difficult to debug.
In the end, you should consider if you really need to use calculated columns in your flow, maybe there’s another non-calculated column you could use instead.