How do I calculate the remaining days until the end of a fiscal quarter?

Should you work for a public company, it is very likely that the fiscal year of your company may not be the same as the calendar year.

This in turn, means, that a bunch of your analyses may need to forecast financials for the fiscal quarters, rather than the calendar ones.

How could you then calculate the number of remaining days until the end of the fiscal quarter?

It follows pretty much the same logic as calculating the number of remaining days until the end of a calendar quarter

The only noticeable difference is that you can no longer use the quarter function

The work around is to base the calculation logic on months.

Good news is that all Vertica, MySQL and SQL Server offer simplified calculations for getting the month from a date

So, let’s assume fiscal year runs from November to Ocotber.

Calculations will then look like these:

Happy SQL-ing!