Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Data Clensing

davidkelly6022
5 - Atom

I am dealing with some messy data and I was wondering how I would be able to clean it up. The data comes in a format such as the one below with headers and sub-headers starting in different columns but the numeric figures all starting in the same column. 

 

Sales   

500

 Product sales  100
  Non-product sales 400

 

I was hoping to be able to pull the headers and sub-headers to the first column, the numeric figures to the second column, and remove null columns so the format would look as it does below. 

 

Sales500
Product Sales100
Non-Product Sales400
3 REPLIES 3
DataNath
17 - Castor
17 - Castor

If your actual data is like the example provided then something like this ought to do the trick @davidkelly6022 - could probably be a little more concise but hopefully makes things easier to follow!

 

13.png

 

We basically pivot all of the dispersed sub-headers into a single column, sort them so that those that are populated will always appear above the empty/null cells and then un-pivot (Cross-Tab), selecting First as the aggregation so it picks the populated record i.e. the sub-header. When plugging in your real data you'll just have to ensure that the Group By in the Transpose and Cross-Tab are the RecordID and the field with your numerical values.

ishan_dania
5 - Atom

.

grazitti_sapna
17 - Castor

 Hi @davidkelly6022 you can refer attached workflow for your reference.
Thanks

Sapna Gupta
Labels