In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the method of intra-group cross-line calculation using SQL window function in Birt, which has a certain reference value and can be used for reference by friends who need it. The following information is about the detailed steps of cross-line calculation.
In this example, there are three fields, where SELLERID is the grouping field, DAY is the field to be compared, and the field type is date-time type. You need to design a grouping table. SELLERID is the grouping field, and the detail fields are DAY, AMOUNT and the calculation column SHIFTTIME. The DAY stored in SHIFTTIME differs from the DAY in the last record in this group by a few days. The source data is as follows:
Use the aggregator to organize the data:
A
1=connect ("db") .query ("select SELLERID, DAY,AMOUNT,0 as SHIFTTIME from SALES order by SELLERID, DAY") queries the database, sorts the SELLERID and DAY fields, and produces an extra column of constant spare 2=A1.group (SELLERID) .run (~ .run (interval (DAY [- 1], DAY): SHIFTTIME) grouped by SELLERID, and modify the calculation column SHIFTTIME3=A2.union () in each group of data and merge each group of data 4return A3 to return the calculation results to the report tool.
Save the above SPL code as sales.dfx and introduce it into the Birt report. For Birt to call SPL, please refer to "BIRT calling SPL script".
Step 1: add an aggregator JDBC data source.
Step 2: create the dataset and edit the Query Text.
Step 3: create a report. The report is designed as follows:
Step 4: WEB preview. The preview result is as follows:
After reading this article, have you learned how to use the SQL window function to implement cross-line computation within a group? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.
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.