Re: Bug report: Filter by date with < operator not working in Azure SQL Database or SQL Server
It seems that Powerapps is recognizing CalendarDate field in database as a DateTimeZone, I tried the following things:
- Convert the type of CalendarDate from "DateTimeZone" to "Date" with:
DateValue(Text(CalendarDate))
But it seems is not doing well the compare.
- Convert the type of the Date to DateTime with:
DateTimeValue(Text(Date(2000, 1, 1)))
it seems that is doing well now the compare but in my case is not returning all rows I expected (don't know why). In my SQL Server doing the sentence:
SELECT * FROM [dbo].[Dispositivos] WHERE Fecha_alta >= '01/04/2016' AND Fecha_alta <= '04/04/2017'
returns 175 rows and powerapps with the sentence:
Filter('[dbo].[Dispositivos]'; DateTimeValue(Text(DatePicker1.SelectedDate)) <= Fecha_alta && DateTimeValue(Text(DatePicker1_1.SelectedDate)) >= Fecha_alta)
Just return 119 rows..
I need a solution for this issue as soon as possible due to I am developing an application in powerapps for a client.
EDIT: My bad, the second thing I did seems to go well. I thought it was returning less values because Powerapps did something bad there but was me who did bad the query in SQL Server because of the format of the date I gave.
You can try @Meneghino if my second solution goes well for you.
Regards,