Forum Discussion
Duplicate a single value and add a criteria
- Anonymous5 years ago
You can make a list column and expand it. First, I would make a new query named Years, which will be your list of years:
Yr = Date.Year(DateTime.LocalNow()),
Yrs = {Yr, Yr-1, Yr-2}
Now you should have a list of 2021, 2020, and 2019. Now go back to your main query, and add a step:
Last3Yrs = Table.AddColumn(LastStepName, "Years", each Years)
Then you can expand the list column and choose "Expand to new rows".
That's it!
--Nate
You can make a list column and expand it. First, I would make a new query named Years, which will be your list of years:
Yr = Date.Year(DateTime.LocalNow()),
Yrs = {Yr, Yr-1, Yr-2}
Now you should have a list of 2021, 2020, and 2019. Now go back to your main query, and add a step:
Last3Yrs = Table.AddColumn(LastStepName, "Years", each Years)
Then you can expand the list column and choose "Expand to new rows".
That's it!
--Nate