Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow negative shift year for fiscal periods #57

Closed
boludo00 opened this issue Feb 10, 2022 · 1 comment · Fixed by #58
Closed

Allow negative shift year for fiscal periods #57

boludo00 opened this issue Feb 10, 2022 · 1 comment · Fixed by #58

Comments

@boludo00
Copy link
Contributor

Some fiscal years are tracked differently, needing support of a negative shift year.
For example, in one scenario a date_day of 2022-01-01 is actually in the fiscal year 2023. The generated fiscal_year_number would need to be 2023 in this case. This can be achieved by suppling a negative shift value however, doing so causes the rendered SQL to be interpreted as a comment:

{{ dbt_date.get_fiscal_periods(ref('dates'), year_end_month=1, week_start_day=2, shift_year=-1) }}
d.year_number -{{ shift_year }} as fiscal_year_number,

Gets rendered as:

d.year_number --1 as fiscal_year_number, this is a comment 👀 

Not sure how everyone else's use case differs, but I thought I would bring it up in case there are more similar scenarios out there.

@clausherther
Copy link
Contributor

Good call, thanks for raising that issue!

@clausherther clausherther linked a pull request Feb 10, 2022 that will close this issue
clausherther added a commit that referenced this issue Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants