community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Transposing a column into rows with an If condition.

I have data of Car with their In and Out dates.

 

Car

Date

Access

M1

2-2-2018

In

M2

2-2-2018

In

M2

2-3-2018

Out

M1

2-3-2018

Out

M2

2-4-2018

In

M1

2-4-2018

In

M2

2-5-2018

Out

M1

2-5-2018

Out

 

I want it to be in such a manner with In and Out date for each Car in a single row, the arrangement of the Cars doesn’t matter just the In and Out should match the dataset.

 

Car

In

Out

M1

2-2-2018

2-3-2018

M2

2-2-2018

2-3-2018

M2

2-4-2018

2-5-2018

M1

2-4-2018

2-5-2018

 

Thank you.

Highlighted
Alteryx Certified Partner

Hey @Jigarpanchal 

 

You could approach it by sorting the dates and access so they are in order, then adding a multirow formula to "group" the access together. Then a simple crosstab to get the final result

 

Capture.PNG

Meteor

Hi Jigarpanchal,

 

My first thought was to approach this in a similar way to how LordNeilLord did, but then I thought of another way that also works while demonstrating how some of the other Alteryx tools work.  Simpler is always good, particularly if it is efficient which LordNeilLord's method is, but having other ways to achieve a problem can help in other circumstances.Jigarpanchal_query.jpg

I hope this helps, but in any case you now have two ways to solve the problem! 

Hi LordNeilLord

 

Thank you for such a quick response, the solution was simple and easy to implement in my worksheet.

Hi Dazzerman,

 

The solution you provided was quite interesting and helpful, I tried implementing both the solution, both work like a charm.

Thank you again for your help and quick response really appreciate it.

Meteor

You're very welcome!  Happy to help.

Labels