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 … Continue reading How do I calculate the remaining days until the end of a fiscal quarter?
It may sound overwhelming but it's actually quite simple, especially if you've already figured out how to: extract various time periods from a date get the end date of the current quarter calculate the number of days between two days As you'll see below - calculating the remaining days in current quarter is then nothing … Continue reading How do I calculate the remaining days until the end of a calendar quarter?
It will depend on the database you're using! As you can see below, there can be quite some variations in syntax between Vertica, SQL Server, MySQL, PostgreSQL So, what's common in all these examples? In all cases, you will need: a function that gets the current date a function that extracts the year from … Continue reading How can I get the end date of a quarter with SQL?
Yesterday, we looked at the standard approach of aggregating daily data stretching over a longer time periods If you're lucky enough to be working with Vertica or MySQL, you can also rely on functions like: year(), quarter(), month(), week(), day() SQL Server also supports some of them - year(), month(), day() - but is by far the most limited of … Continue reading How do I extract part of a date with SQL? (2)