We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Sorting the data based on due date and product

NakulMalisetty
7 - Meteor

Hi Everyone,

 

I need some help on the sorting, the sorting should be done on 'due date' then grouped by 'Product' for each row. The data with lesser due days is 2 so, it should be the first record however, instead of picking 'due date' 3 as the next record, it should group the 'Product' for the first record then it should go to next 'due date' and do the same.

 

Below tables show the input and expected output. Any suggestions would be appreciated.

 

INPUT    OUTPUT  
OnlineA10  Order TypeProductDue Days
OfflineA3  OfflineC2
Third partyA11  Third partyC4
OnlineB4  OnlineC8
OfflineB5  OfflineA3
Third partyB6  OnlineA10
OnlineC8  Third partyA11
OfflineC2  OnlineB4
Third partyC4  OfflineB5
     Third partyB6

 

Thanks

Nakul

11 REPLIES 11
alexnajm
18 - Pollux
18 - Pollux

Sort by Product DESC and Due Date ASC

NakulMalisetty
7 - Meteor

Thank you Alex for the response. My requirement is slightly different, I made change to the sample output. 

Data should be sorted on the due date, while the nearest due date is 2 and it's product is 'C', it should group the product.

alexnajm
18 - Pollux
18 - Pollux

@NakulMalisetty so because the minimum due date of a particular product is smallest, it should be listed first and all subsequent rows for that product should go with it?

NakulMalisetty
7 - Meteor

Exactly! If the product is 'C' for the smallest due date then the following rows should be of Product 'C'. Once done with the 'C', next it should look for the available smallest due date, in our case it is 3 and the product for this is 'A', now it should get all the records of product 'A'.

alexnajm
18 - Pollux
18 - Pollux

Your input data and output data don't match value-wise, but I understand the question - here is a solution:

NakulMalisetty
7 - Meteor

Alex, apologies for the miscommunication. The output should exactly look like the below.

 

OUTPUT
Order TypeProductDue Days
OfflineC2
Third partyC4
OnlineC8
OfflineA3
OnlineA10
Third partyA11
OnlineB4
OfflineB5
Third partyB6
alexnajm
18 - Pollux
18 - Pollux

That output does not make sense based on the input data provided. Please provide new data if that is the case - my workflow works perfectly for the input data and logic provided

NakulMalisetty
7 - Meteor

Let me be more clear, in the input data the smallest due day is 2 so, the first row will be (Offline, C, 2). 

The product in the first row is 'C' so, the next step is to bring all the product with 'C' (2nd & 3rd rows in the output)

Next it should look for the smallest due day available, which is (Offline, A, 3) in our case

Now we should bring all the products with 'A' (5th & 6th rows in the output)

similarly we should look for the next smallest due day available, which is (Online, B, 4) in our case

Next to get all the products with 'B' (8th & 9th rows in the output)

 

alexnajm
18 - Pollux
18 - Pollux

I understand fully, and my solution works for the input you have provided. I think you are using different data now than originally provided - for example, there is no (Offline, A, 3) in your original

data

Labels
Top Solution Authors