2.9 Grouping: sum
Calculate the total sales amount of each product based on the following daily sales table.
Date | Product | Sales |
---|---|---|
2022-01-01 00:00:00 | Cereal | 98.0000 |
2022-01-01 00:00:00 | Meat | 174.0000 |
2022-01-02 00:00:00 | Cereal | 168.0000 |
2022-01-02 00:00:00 | Meat | 167.4000 |
2022-01-03 00:00:00 | Cereal | 1696.0000 |
… | … | … |
SPL script:
A | |
---|---|
1 | =T(“DailySales.xls”) |
2 | =A1.groups(Product;sum(Sales):Sales) |
Execution result:
Product | Sales |
---|---|
Cereal | 309998 |
Meat | 174645 |
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_SPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL