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 Filesource node to the canvas. Open theDailySales_Store1.csvfile. - Under the
Data Type Assignmenttab, make sure the "SKU" field is the String data type. - Repeat step 2 and 3 for the
DailySales_Store2.csvandDailySales_Store3.csvfiles. - Add a
Filternode to the canvas. Attach theDailySales_Store3.csvflat file source node to it. - Filter out the "Description" field to remove the unnecessary field.
- Add a
Unionnode to the canvas. Attach theFilternode as well as the other flat file source nodes to it. - Configure the node to perform a union between all three nodes.
- Add an
Aggregatenode to the canvas. Attach theUnionnode 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 Fileexport node. Configure to export to `SalesOutput.csv'.