Start Free Trial

Alteryx Designer Desktop Discussions

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

Data Transpose/CrossTab with date as header

aksharma89
6 - Meteoroid

Hi Team,

 

I am working on a scenario where I need to transpose the data in following way :

 

START_DTPRODCUTCOUNTRYREGIONID1_qtyID2_qtyOD1_qtyOD2_qtySH1_qtySH2_qty
10/25/17ABCUSAAMR562356
10/25/17DEFCHINACHN221122

 

Expected data :

 

PRODCUTCOUNTRYREGIONinput_dtoutput_dtship_dtinput_qtyoutput_qtyship_qty
ABCUSAAMR10/25/1710/25/1710/25/17525
ABCUSAAMR10/26/1710/26/1710/26/17636
DEFCHINACHN10/25/1710/25/1710/25/17212
DEFCHINACHN10/26/1710/26/1710/26/1721

2

 

 

where ID1_DT is start_dt and and ID2_DT is start_dt + 1 similarly for output_Dt also

 

Can you please help to suggest a way to achieve this.

4 REPLIES 4
jdunkerley79
ACE Emeritus
ACE Emeritus

I suggest the following:

2017-11-04_10-26-54.jpg

First, parse the date (from MM/dd/yy into Alteryx format).

Next, transpose the data so ID1_qty, ID2_qty, etc become rows.

I then used REGEX to split the names to ID/OD/SH and 1 or 2

Next cross-tab to get ID, OD and SH as columns but split as 2 rows (1 and 2)

 

Then just a case of tidying up. I used a formula tool to adjust the date for the 2 rows and then a couple of formula tools to clone the date column

Finally a select tool to rename to match required output

 

Sample attached

aksharma89
6 - Meteoroid

Hi jdunkerley79,

 

Thank you so much for your response.This is what I was searching for.But the issue am facing is my Regex operation is not behaving correct when by input fields are going 10.

 

In my business scenario I have 14 input ,14 output,14 ship values.And my outcome is only able to result till 9 values only.

 

Regex in your wf: (..)(\d).*

 

Issue : 

 

Input_Date  fieldname

----------  --------------------

2017-10-25  ID1

2017-10-25  ID10

2017-10-25  ID11

2017-10-25  ID12

2017-10-25  ID13

2017-10-25  ID14

2017-10-26  ID2

2017-10-27  ID3

2017-10-28  ID4

2017-10-29  ID5

2017-10-30  ID6

2017-10-31  ID7

2017-11-01  ID8

2017-11-02  ID9

 

As soon as ID10 came the regex did not splitter as expected.

 

Attached the workflow for the below data.

 

Can you please suggest correction to the regex expression .

 

Thanks,

Atul

 

Date_published VendorVendor_SiteProgramPO_typeRegion Part_number ModelMLBCapacity ColorWk1_PriorityQtyWk2_PriorityID1ID2ID3ID4ID5ID6ID7ID8ID9ID10ID11ID12ID13ID14OD1OD2OD3OD4OD5OD6OD7OD8OD9OD10OD11OD12OD13OD14SH1SH2SH3SH4SH5SH6SH7SH8SH9SH10SH11SH12SH13SH14Remarks 
10/25/17MPGMKSNXRepAMRxxxx-xxxxxxA1XXB3X16GBA(GRAY)p150030200000000000003171909200000000039092000000000 
jdunkerley79
ACE Emeritus
ACE Emeritus

Change the regex to  (..)(\d+).*  and then it should work.

aksharma89
6 - Meteoroid

Hi  

 

Thank you so much for your help .It really helped me a lot to solve my Problems statement!!

 

Regards,

Atul

Labels
Top Solution Authors