In other words, say you want to display a graph showing the last year's results, but only have data for the last three quarters, your graph would begin in April rather than January. I will address this problem in the final article of this series. You will want to consider a variation of this approach when rolling data up by calendar units.Ī deficiency of this method is that, because it is based solely on the underlying data, it can only return groups for time bands in which which you have data. The example below shows how to roll up data in SQL Server by time band using the built-in DATEPART or DATENAME functions. The following two articles will show how to group SQL Server by date/time with DATEDIFF and DATEADD and how to group data by date/time with a temp table. This article is the first in a series of three that demonstate various ways to slice data by time band.
0 Comments
Leave a Reply. |