Forum Discussion
Dynamic Column Name
- 6 years ago
sabeensp see attached, look at table called Table in power query and it take the current year as a base and then replaces column names accordingly. It can be improved further but I think it is a good start.
sabeensp see attached, look at table called Table in power query and it take the current year as a base and then replaces column names accordingly. It can be improved further but I think it is a good start.
- mahoneypat6 years agoMicrosoft Employee
I would have approached it the same way parry2k , with Table.ColumnNames and List.Zip. A small change to reduce the number of steps would be to use this formula to make the list of Years for the column names with this:
=List.Transform({-1..3}, each Number.ToText(currentYear + _))
Regards,
Pat
- parry2k6 years agoSuper User
mahoneypat agreed, assuming column numbers are in the same order and that's the reason I decided to not go with that path but thanks for pointing it out.