'Azure Logic App: Filter Query Difference between dates should not exceed 10 months
Like in SQL Server, we find the difference between dates using DATEDIFF as below, I'm try with OData filter Query in SQL Server - Get Rows Connector but I don't see a DateDiff function available.
SELECT DATEDIFF(month, DateOfBirth, GETDATE()) AS DateDiffInMonths from employees where DateDiffInMonths > 10;
I've tried below ODATA query by referring few links of Power Automate but it doesn't work as DateDiff doesn't exist in Expressions looks like
DateDiff(utcNow(), DateOfBirth, Months ) ge 10
Could you please share suggestions on how we can achieve this using OData Filter query or any other way to filter out table records straight away during Get Rows itself?
Thanks in Advance
Solution 1:[1]
To query for 10 months you can use filter query to be
month(hire_date) lt month(@{subtractFromTime(utcNow(),10,'Month')})
For example:- Consider I have these records

Here is the output
In General you can use
year(hire_date) gt year(<Timestamp>) and
month(hire_date) gt month(<Timestamp>) and
day(hire_date) gt day(<Timestamp>) and so on
You can even change the datetime format and have the comparison for the same.
To query in general

Here is the output I received

REFERENCES: Azure Logic App SQL ODATA Filter on Date
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |


