I'm trying to use the in-built Pivot feature for Tableau and I realized that it's only available for Excel and Text files, but I'm trying to pivot the table using a MSSQL connection. Can anybody help me figure out how to do this? I'm an intern and pretty new to SQL queries too so I wasn't expecting that Tableau didn't have pivots enabled for SQL connections.
The question is how to pivot a file that's formatted like this:
|OrderID||Part #||PickingOrderLineID||FulfillmentLocationID||QuantityRequested||QuantitySent||Picked By||Packed By||Shipped By||Packed Date||ShippingCreated Date||FulfilledDate|
|6883424||838||6994779||6503||1||1||Evan Obrien||Evan Obrien||Evan Obrien||1/23/19 6:57 PM||1/23/19 7:04 PM||1/23/19 6:56 PM|
|6881415||207||6992508||6503||5||3||Larry Ferg||Colt Grish||Colt Grish||1/23/19 7:19 PM||1/23/19 7:20 PM||1/23/19 6:29 PM|
|6881118||475||6992192||6503||6||6||Larry Ferg||Colt Grish||Colt Grish||1/23/19 7:22 PM||1/23/19 7:22 PM||1/23/19 6:21 PM|
|6885308||313||6996671||6503||1||1||Alex Tilray||Anna Hendrix||Anna Hendrix||1/23/19 7:48 PM||1/23/19 7:49 PM||1/23/19 6:47 PM|
|6885300||312||6996663||6503||1||1||Alex Tilray||Anna Hendrix||Anna Hendrix||1/23/19 7:48 PM||1/23/19 7:49 PM||1/23/19 6:36 PM|
|6883403||310||6994758||6503||4||4||Alex Tilray||Anna Hendrix||Anna Hendrix||1/23/19 7:48 PM||1/23/19 7:49 PM||1/23/19 6:56 PM|
Into A pivoted table that resembles the above table very much, but just instead of pickedby packedby and shippedby being seperate columns its under one column as name and the respective packed, shipped, or fulfilled dates are complied as one 'Action Date' column?
|All Actions||Name||Quantity Requested||Quantity Sent||Fulfilled Date||Packaged Date||Action Time||Specific Action|
|Fulfilled By||Anna Hendrix||1||1||1/16/2019 15:52||1/16/2019 15:59||1/16/2019 15:52||Picking|
|Fulfilled By||Alex Tilray||1||1||1/16/2019 15:27||1/16/2019 15:57||1/16/2019 15:27||Picking|
|Packages Created By||Colt Grish||1||1||1/16/2019 13:22||1/16/2019 13:26||1/16/2019 13:26||Packing|
|Shipped By||Evan Obrien||1||1||1/23/19 6:56 PM||1/23/19 6:57 PM||1/23/19 7:04 PM||Shipping|
Note that I'd like to know how the custom SQL query is set up to make this happen. I tried looking into MSSQL's webpage on pivots but that doesn't seem to be helping and I know the Tableau forums are very responsive and accurate!
Pivot.xlsx 9.3 KB