Forum Discussion
sauravguha
Helper I
6 years agoPower query date consolidation
Hello I have a question if Power Query can help. I have a list of names with different Start and End dates columns with different leave types. Dates may be in continuation but in different rows. i nee...
- 6 years ago
sauravguha , shared solution in PM. Created start date and end dates based on the continuous streak
v-easonf-msft
Community Support
6 years agoHi, sauravguha
Here is demo.
If help ,try follow steps:
1.Add custom as below and expend the list:
=List.Dates([Date From],Duration.Days([Date To]-[Date From])+1,#duration(1,0,0,0))
2. Remove two column "Date From " and "Date to"
3. Then group rows as below
3.Add custom colum "split"as below
=Table.Group(let a = [Data]
in
Table.AddColumn(a, "New"
,each
let d = [Date],
t = Table.AddColumn(
Table.SelectRows(a, each [Date] <=d),"Temp", each Duration.Days(d-[Date])
)
in
Table.Min(Table.SelectRows(t, each [Temp] <=Table.RowCount(t)),"Date")[Date]), {"New"}, {{"Date To", each List.Max([Date]), type date}})4.Then remove the column "Data " and expand the column "Split"
If I misunderstood your request, please explain more about your calculation logic.
And I am afraid the excepted result you attached is a bit wrong, as i dont see anywhere Monty's record.
Best Regards,
Community Support Team _ Eason
sauravguha
Helper I
6 years agoThank you so much for the assistance, it works very well. will try on a live data and let you know if i face any challenge.