Source: http://developer.actuate.com/community/forum/index.php?/topic/36323-months-and-quarters-group-issue/
Irregular month Statistics: If the starting time is 2014-01-10, then the 2014-01-10 to 2014-02-09 as a group, 2014-02-10 to 2014-03-9 as a group. If the start time is 2014-01-31, then 2014-02-27 is used as a group, and 2014-02-28 to 2014-03-30 as a group.
The Collector code:
A1: Queries the database based on the start and end time, where StartDate and EndDate are external parameters.
A2: Calculates the month interval based on the starting and ending time. For example, 2014-01-31 and 2014-07-31 interval 6 months.
B2: Calculates the start date of the irregular month based on the start time and date interval, and inserts the start time into the 1th position. | Represents a merge, "~" represents the current member in the collection, that is, the number 1 to 6,after function calculates the irregular month correctly. The results are as follows:
A3: The A1 is grouped by B2 interval, the sales of irregular months are counted and B2 as the last column. The function pseg can return the interval number where the data resides. The ~ in ~.sum (Amount) represents the current group after grouping. #表示A1当前组号. The calculation results are as follows:
A4: Take out the 2nd and 3rd columns of the A3 and return to the report tool. The collector provides the JDBC interface externally, and the report tool recognizes the collector as a normal database.
The following is a simple list table designed with Birt:
The report calls the collector the same way you call a stored procedure, such as saving this script as BIRTUNREGULMONTH.DFX, which you can use in the Birt stored procedure designer by calling Birtunregulmonth (?,?) To invoke. Preview the following table sample:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Report example--using Birt to achieve irregular month statistics