Forum Discussion
nickvanmaele
3 years agoAdvocate II
Add a variable number of columns automatically, based on parameters
Hi, My question is how I can add a variable number of date columns to an existing table in an automatic way. Context I am trying to create a large fact table filled with test data by using on...
- 3 years ago
This is easier to do directly in an unpivoted format (you can pivot afterward if you feel like it).
Add a custom column that is a list of dates from pStartDate to pEndDate.
List.Dates(pStartDate, Duration.Days(pEndDate - pStartDate)+1, #duration(1,0,0,0))Then expand this list column.
AlexisOlson
3 years agoSuper User
This is easier to do directly in an unpivoted format (you can pivot afterward if you feel like it).
Add a custom column that is a list of dates from pStartDate to pEndDate.
List.Dates(pStartDate, Duration.Days(pEndDate - pStartDate)+1, #duration(1,0,0,0))
Then expand this list column.