Free Trial

Alteryx Designer Desktop Discussions

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

Assigning unique numbers to nonidentical rows based on conditions & variance in diff rows

nfoong
7 - Meteor

 

Hi all,

 

This is quite a complicated ask in my opinion but I have 2 questions that I would like regarding the sample of the data below. The original dataset contains thousands of rows hence it is making it very difficult to make sense of it.

 

Ask #1: I need to assign a unique contract # as per below to thousands of rows and I need a way of saying if the SWIFT_ID and WEEKLY_COST is the same, assign the same unique number. If it is not the same, assign a unique number. An example of how it should look like is as below.

 

Ask #2: For the same SWIFT_ID but different Unique Contract # (eg: 4617 below with Unique Contract #1 & #2), calculate the difference between the weekly cost (£626.19 - £101.40) - this is so that I can identify the highest cost differentials between the different contracts. The next step would be to extract the top 10 contracts with the highest increase from the lowest value to the highest value in weekly cost.

 

 

SWIFT_IDUnique Contract #COST_START_DATECOST_END_DATEWEEKLY_COST
4617108/04/201330/12/2015£626.19
4617207/04/201430/12/2015£101.40
4639308/04/201315/11/2015£546.00
4639407/04/201415/11/2015£120.80
4639416/11/2015 £120.80
5940529/04/201622/09/2016£1,950.00
5940623/09/201623/09/2016£0.00
6445717/07/201428/01/2016£1,100.00
6445728/01/201626/02/2016£1,100.00
6445828/01/201627/04/2016£1,824.64
6463901/04/2013 £92.34
64631008/04/2013 £1,131.44

 

Please let me know if you have any questions and thank you so much for your help!

 

Regards,

Nicholas

5 REPLIES 5
jdunkerley79
ACE Emeritus
ACE Emeritus

For 1:

I would do this using the Unique tool to create the unique set and then use a multi row formula grouped by SWIFT ID to assign a contact number.

Finally join back to the input and you should be done.

 

For 2:

You can use a multi row formula to create the differences then a summarise to get the max. You will need to convert weekly cost to a number,

 

Have put together a sample

 

DataBlender
11 - Bolide

For 1: I would suggest using the 'unique value' option of the Tile tool - you can accomplish this within one tool by selecting SWIFT ID and WEEKLY cost as your conditions. Note that two fields are created. Tile number is the assigned tile of the record. Tile sequence number is the record number of the record's position within the Tile.

 

2016-12-14_12-55-38.png

 

For 2: Refer to @jdunkerley79's response

 

On a separate note, @jdunkerley79, I saw in your workflow that you have a dynamic rename as I presume you copied and pasted OP's sample data into the text input tool? If you place the cursor in the 'Field1' header and then press the paste button (rather than ctrl + v), then the table will be correctly formatted.

 

Apologies if that comes across condescending, just trying to help save some time :)

jdunkerley79
ACE Emeritus
ACE Emeritus
@DataBlender nice tip - will make it quicker to reply :)
nfoong
7 - Meteor

Thank you!

 

I think I've pretty much solved it thanks to your solution but can you please tell me what this means in the formula:

 

[Row-1:ContractID]+1

 

 

jdunkerley79
ACE Emeritus
ACE Emeritus

It is being used to create a unique id within the SWIFT_ID for each payment. It adds one to the previous rows value for ContractID.

 

This is the same as a RecordID tool but allows resetting within each group (SWIFT_ID).

Labels
Top Solution Authors