Clean and Aggregate Multiple Text Files
- 23 Dec 2022
- 1 Minute to read
- Print
- DarkLight
Clean and Aggregate Multiple Text Files
- Updated on 23 Dec 2022
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Goal: You're a sales manager tracking sales for a few stores. You receive multiple daily sales files every morning. Automate the aggregation of sales data at the total store level.
High-level Task: Combine the DailySales_Store1.csv
, DailySales_Store2.csv
and DailySales_Store3.csv
files. Group by the "SKU" field to calculate sums for the "Quantity" and "Revenue" fields. Export to flat file.
Detailed Task:
- Create a new flow.
- Add a
Flat File
source node to the canvas. Open theDailySales_Store1.csv
file. - Under the
Data Type Assignment
tab, make sure the "SKU" field is the String data type. - Repeat step 2 and 3 for the
DailySales_Store2.csv
andDailySales_Store3.csv
files. - Add a
Filter
node to the canvas. Attach theDailySales_Store3.csv
flat file source node to it. - Filter out the "Description" field to remove the unnecessary field.
- Add a
Union
node to the canvas. Attach theFilter
node as well as the other flat file source nodes to it. - Configure the node to perform a union between all three nodes.
- Add an
Aggregate
node to the canvas. Attach theUnion
node to it. - Configure the node to aggregate on the "SKU" field, and calculate the aggregate SUM function on the other two fields (Quantity and Revenue).
- Attach this node to a
Flat File
export node. Configure to export to `SalesOutput.csv'.
Was this article helpful?