Filter records with date in current quarter

Options

I'm trying to filter for records with a date in the current quarter (e.g. Q1 2023 is Jan 1 - Mar 31 2023). This post shows how to filter for records with a date between two dates. Will I have to calculate the start and end dates of the current quarter? If so, any suggestions on how best to do that please? I basically would need to ascertain the quarter in which the current date falls.

Thanks.

Best Answer

  • dorian
    dorian Member
    Answer ✓
    Options

    Sorry perhaps I wasnt clear. My desired end result is to show all transaction quarter-to-date (QTD, i.e. for the current quarter).

    So I first need to determine the current month, to know which quarter I am in. And I need to know the current year because obviously the start/end dates of each quarter change every year.

    I have it working now using this approach:

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi,

    I think what you are looking for is filter "transform_timestamp". if you want to calculate quarters easily you can do this like this. The result of the below variable will be a a timestamp from the beggining of march 1

  • dorian
    dorian Member
    Options

    Thanks @Pawel Magdanski, but I first need to know which quarter the current date falls in, before doing the above - right? How would I ascertain that?

  • dorian
    dorian Member
    Options

    I got it. I can get the current month using the format_timestamp filter on 'now', and go from there.

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    If you are operating with quarters then the begginning and end of every quarter is fixed in terms of date. Unless your apprach is different?