Count records within a date range and display on table

Count records within a date range and display on table

Is there a way to count the number of records between a date range? I have a form where clients can record a meeting wherein they can enter a date for the meeting. I also have a second form wherein there is a filtering option. First option is the 2 years filter where records from last year up to the current year will be counted and displayed on a table. The second option is the custom filter where I can enter a start date and an end date. I took the month and year of the three date fields and used that in my criteria. The problem is that <= and >= do not work on string expressions. I tried converting the months and years to bigint using the toLong() function but it produced an error regarding the evaluation of the numeric expression being the variables where I assigned each of the converted years.