Working with table containing 5 columns and many rows. Only column to note is Order_number. I need to be able to calculate the percent change between rows that have the same order_number, using first row as a reference.
Example: Say we have four rows with the same order_id, using the earliest time as a reference, we can see that one row has one column difference and one that has two columns different. The newly created column calculates the percent difference.
Before:
Order_number | color | price | location | time
5 | blue | 2.99 | Ohio | 11:30
5 | red | 2.99 | Ohio | 11:49
5 | green | 2.99 | Ohio | 11:49
5 | blue | 2.99 | Ohio | 11:49
After:
Order_number | color | price | location | time | percent_change
5 | blue | 2.99 | Ohio | 11:30 | 0
5 | red | 2.99 | Ohio | 11:49 | 40
5 | green | 2.99 | Ohio | 11:49 | 60
5 | blue | 2.99 | Ohio | 11:49 | 20