How to filter records by current month, week, today?

Options

I am trying to create a filter that shows the data from the current month, current week and today. I previously had this filtered by the last 30 days, last 7d days using a timestamp_subtract_days filter with the number of days as input. However I am stuck on figuring out how I can filter by the current month, week. Does anyone know how can I do this?

This is how I have my endpoint right now

Best Answer

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    edited September 2023 Answer ✓
    Options

    Hi @rodrigoayala31 - You can leverage the now value and combine it with filters such us "timestamp_month", "timstamp_week", etc.

    I also see you have many query all records in your function stack. There's a good chance, depending on what records you're trying to get back, that some or all can be combined by using multiple expressions to filter your records.

Answers

  • rodrigoayala31
    Options

    @Michael Udinski thank you so much that is really helpful! Actually in my function stack I do have many query all records, just the first one get data as is based on the filter. However the other queries are getting a count of a specific field from each of the records. Perhaps there is a way I can make those queries at the same time?

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    Instead or querying the records again for a count, you could just put the return variable in a create variable function and apply the count filter to it. This will return the total count of records