Preppin Data — 2019W08
2 min readAug 8, 2020
Key Learning
When using Pivot — rows to columns, cannot pivot more than 1 column at once.
Sample Input
Solution Steps
Expectation
- Store Names to be split on ‘-’ and used to join against store ID column from Theft Audit data
- Fix the type name using group and replace options
- Pivot row to columns to get theft and inventory fix in different columns
- Calculate the remaining columns requested for.
Implementation
- Step 1 and 2 are same as above
- The Pivot option did not work because there were 3 column I had to aggregate and convert — Quantity and Date against the Action Dimension
- Another issue I have faced is because the I couldn't drag Action field into the dimension space — May be a bug.
- Next steps — Duplicate the flow till here to split the data on Action — Theft and Adjustment.
- Update the column names for Dates and Quantity from both flows and join both flows based on the other fields.
- Cleanup the duplicate fields and calculated variance on stock adjustment and no. of days taken to implement adjustment.