Remove older overlaping date periods

dalavouras

New Member
Joined
Feb 17, 2017
Messages
8
Hi
I have a query in Power Query like:
Site id | Start Date | End Date | Value 1 | Value 2 | Value 3 |

The date periods are random and dataset comes every month as a txt file. Newer txt often contain corrections of older ones but do not necessarily share start date or end date. My goal is to keep the latest records and split the older ones to fill whatever remains (still newer should come first) and change the values 1 etc. according to the split date span.
Example:
Older record:
Site IdStart DateEnd DateValue 1Value 2Value 3
58002/01/202021/01/2020102030
65615/01/202005/03/2020653045
68901/01/202031/01/20205080
60​

new record:
Site IdStart DateEnd DateValue 1Value 2Value 3
58012/01/202030/02/2020203050
88803/02/202015/03/2020327560
68901/02/202029/02/20206070
30​

then keep the new one as is and make the older like:
Older record:
Site IdStart DateEnd DateValue 1Value 2Value 3
58002/01/202011/02/2020=(10/20)*10=5=(10/20)*20=(10/20)*30
65615/01/202005/03/2020653045
68901/01/202031/01/20205080
60​
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,216,219
Messages
6,129,579
Members
449,519
Latest member
Rory Calhoun

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top