I have ti combine files with columns of sales and quantities.
Each file contains 2 or 3 years of data. Example of a file columns:
Customer | sales 2010 | quantities | sales 2011 | quantities
The problem is that the name quantities contains no year. I would like to rename the columns in order to get quantities 2010, quantities 2011, etc.
So taking the 4 digits from the name of the previous column and concatenate it with the string quantities.
Of course, in power query.
I tried the following:
For each table, this means in the “Transform file” step ==>
Get the column names in a list
Access to the previous value with the index column method
Concatenation of the words quantities and the digits of the previous column name
This works but it is fastidious
Is there a simpler M code?
hamid is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1