In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Aggregator implements irregular month statistics in Birt and other report tools
In business reports, it is often necessary to make grouping statistics based on time periods, especially by month. In general, it is easy to group by natural month, but sometimes it is necessary to group by irregular month. For example, an enterprise begins to implement some special pricing strategy or marketing activity on January 16, so it wants to count the sales of its products on the 16th of each month. The so-called irregular month here refers to: if the starting time is 2013-01-16, then 2013-01-16 to 2013-02-15 as a group, 2013-02-16 to 2013-03-15 as a group. More specifically, if the start time is 2013-01-31, then 2013-01-31 to 2013-02-27 may be required as a group, and 2013-02-28 to 2013-03-30 as a group, that is, starting with the last day of the month.
How's it going? Aren't you guys a little silly? For reporting tools such as Birt, expressions grouped by natural month are generally provided, but they are also difficult to deal with such irregular month grouping expressions. If we want to solve this problem, we often need to write a program to implement a custom report dataset, and grouping according to this rule in the program, not only the programming workload is not small, but more importantly, it is basically impossible to be universal.
Now, if you introduce an aggregator into the reporting tool, it will be easy to solve this problem. Let's take the Birt reporting tool as an example to explain the process of implementation. For other reporting tools, it's pretty much the same.
In this example, the total monthly sales of the enterprise from 2013-01-16 to 2013-08-15 are counted. The raw data in data table salesall is as follows:
Finally, you need to get the target table shown in the following figure:
Let's take a look directly at the aggregator's SPL code to solve this problem:
AB1=connect ("demo")
2=A1.query ("select OrderID,Amount,OrderDate from salesall where OrderDate > =? and OrderDate"
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.