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 | ||||||
Online | A | 10 | Order Type | Product | Due Days | ||
Offline | A | 3 | Offline | C | 2 | ||
Third party | A | 11 | Third party | C | 4 | ||
Online | B | 4 | Online | C | 8 | ||
Offline | B | 5 | Offline | A | 3 | ||
Third party | B | 6 | Online | A | 10 | ||
Online | C | 8 | Third party | A | 11 | ||
Offline | C | 2 | Online | B | 4 | ||
Third party | C | 4 | Offline | B | 5 | ||
Third party | B | 6 |
Thanks
Nakul
Solved! Go to Solution.
Sort by Product DESC and Due Date ASC
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.
@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?
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'.
Alex, apologies for the miscommunication. The output should exactly look like the below.
OUTPUT | ||
Order Type | Product | Due Days |
Offline | C | 2 |
Third party | C | 4 |
Online | C | 8 |
Offline | A | 3 |
Online | A | 10 |
Third party | A | 11 |
Online | B | 4 |
Offline | B | 5 |
Third party | B | 6 |
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
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)
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