I have the following dataset that I am reading into Power Query:
Value
36628848
36659230
36709969
O-386082
O-390825
O-390827
37419002
37689374
O-390274
37919295
38012195
O-390586
O-380013
38104658
38287760
The values starting with O-
belong to the value in the row above it, so for example O-386082, O-390825, O-390827 all belong to 36709969.
I would like to create another column which has the parent of each 'O-' entry. So the output should look like:
Value Parent
36628848 36628848
36659230 36659230
36709969 36709969
O-386082 36709969
O-390825 36709969
O-390827 36709969
37419002 37419002
37689374 37689374
O-390274 37689374
37919295 37919295
38012195 38012195
O-390586 38012195
O-380013 38012195
38104658 38104658
38287760 38287760
Doing this in Excel is easy, because I can do: Parent = Value if Value does not start with 'O-' else Parent @ row-1
I have tried using Table.Range but I can not run it on the same table. Is there a way to this in Power Query?
Thanks!