We've done it as follows. In our SQL query for the data set, we select both (for example) "char(my_date,iso)"
and "left(char(date,iso),7)"
(for 2009-01-05
and 2009-01
respectively), something like:
select
left(char(my_date,iso),7) as isoyyyymm,
char(my_date,iso) as isodate,
otherfield as value
from tbl
order by my_date
Then, when you create your table in the report, column 1 should be the grouping column based on isoyyyymm and blank out for that column in the table:
- the heading,
- the group data line; and
- the detail data line.
So you end up with, in the designer:
+--------------------------------+-----------+-----------------+
| <Header row> | Date | Value |
+--------------------------------+-----------+-----------------+
| <Group header row (isoyyyymm)> | | |
+--------------------------------+-----------+-----------------+
| <Detail row> | [isodate] | [value] |
+--------------------------------+-----------+-----------------+
| <Group footer row (isoyyyymm)> | | Total.sum( |
| | | row["value"], |
| | | null, |
| | | "Grp1") |
+--------------------------------+-----------+-----------------+
The report table will still group on the month but the displayed detail lines will all contain the full date:
Date Value
---------- -----
2009-01-01 7
2009-01-08 2
2009-01-15 1
2009-01-22 4
-----
14
2009-02-05 2
2009-02-12 0
2009-02-19 0
2009-02-26 1
-----
5
You can group on intervals if you want to do it that way but we've opted for the simplest approach for those situations where we can use simple strings. Obviously, if your interval is a week (or something else not amenable to simple string analysis), you'll need to use the interval grouping built into BIRT.
The best tutorial for this (in my opinion), is on page 187 (in chapter 12) of BIRT, A Field Guide to Reporting. That, and Integrating and Extending BIRT are must-haves for any serious BIRT user.
This first is absolutely vital to any report designer. The second covers much more advanced topics such as embedded Java and Javascript, the report object model and the underlying architecture of BIRT. This is required if you want your reports to be truly spectacular.