Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

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

$
0
0

 

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


Viewing all articles
Browse latest Browse all 4999

Trending Articles