Date Calculation

How do I write a calculation to return the same date but for next month? For example, if the date showing is December 4, 2024, how do I return January 4, 2024?

Best Answer

  • Data_Devon
    Data_Devon Contributor
    Answer ✓

    I'd use the AddDate() function like so:

    ADDDATE('2024-12-04', INTERVAL 1 MONTH)

    If you intend to also jump to the next year - i.e. from December 2024 to January 2025 - that will be an extra step.

    You can also use the canned "Date Operations" tile in Magic ETL if you want to do it upstream:

    ✅Did this solve your problem? Accept it as a solution!

    ❤️Did you love this answer? Mark it as "Awesome"!

    👍Do you agree with this process? Click "Agree"!

Answers

  • Data_Devon
    Data_Devon Contributor
    Answer ✓

    I'd use the AddDate() function like so:

    ADDDATE('2024-12-04', INTERVAL 1 MONTH)

    If you intend to also jump to the next year - i.e. from December 2024 to January 2025 - that will be an extra step.

    You can also use the canned "Date Operations" tile in Magic ETL if you want to do it upstream:

    ✅Did this solve your problem? Accept it as a solution!

    ❤️Did you love this answer? Mark it as "Awesome"!

    👍Do you agree with this process? Click "Agree"!

  • Thank you!!!

  • Just for clarity, what @Data_Devon is referencing is your field name, not a static value.

    DATE_ADD(`your_date_field`, INTERVAL 1 MONTH)

    ** Was this post helpful? Click Agree or Like below. **
    ** Did this solve your problem? Accept it as a solution! **