Forum Discussion
Loop through table to turn one row into multiple rows
- 10 years ago
Before trying to do anything else, you should make sure the column is of type date (you can do this in the wizard under transform). Then, you can use something like this M code to get the rest of it done:
#"Added Custom" = Table.AddColumn(#"Changed Type", "Days", each Duration.Days([End] - [Start]) + 1),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom", each List.Dates([Start], [Days], #duration(1, 0, 0, 0))),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom1", "Custom")
Before trying to do anything else, you should make sure the column is of type date (you can do this in the wizard under transform). Then, you can use something like this M code to get the rest of it done:
#"Added Custom" = Table.AddColumn(#"Changed Type", "Days", each Duration.Days([End] - [Start]) + 1),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom", each List.Dates([Start], [Days], #duration(1, 0, 0, 0))),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom1", "Custom")