您可以使用 M (Power Query) 来实现这一点,我的解决方案不会像“IntervalType”那样管理您要求的所有细节,但允许您在输入标准化后获得所需的行。
下面的 M 脚本将满足以下要求(您可以使用高级编辑器查看完整的脚本):
{here you have already loaded your table}
/*Calculate the difference between the 2 dates in days*/
/*note that if the end date is 9999-12-31 you may want to set an upper limit*/
#"Added Custom" = Table.AddColumn(#"Changed Type", "DaysInterval", each Duration.Days([EndDate]- [StartDate])),
/*Calculate how many times the service will be performed in the calculated interval*/
#"Added Custom1" = Table.AddColumn(#"Added Custom", "IntervalOccurence", each Number.RoundDown([DaysInterval]/[Interval])),
/*Use what has been calculated so far to create a list of dates for each row*/
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "ListDates", each List.Dates([StartDate],[IntervalOccurence],#duration([Interval], 0, 0, 0))),
/*Expand the list to rows (using the UI click on the arrows in the column header)*/
#"Expanded ListDates" = Table.ExpandListColumn(#"Added Custom2", "ListDates")
之后,您只需删除不需要的列。