title: How to rename headers using a loop in Power BI?
body: <p>I have a situation where I need to rename headers based on a table with the old name (HeadersTranslated[HeaderList]), the new name (HeadersTranslated[HeaderEnglish]) and an indeks number (HeadersTranslated[Indeks]).</p>
  
  <p>I am therefore trying to loop through the indeks numbers and do a Rename for each.</p>
  
  <p>However I cannot seem to get it working for more than 1 column at a time (by replacing <code>StartTheLoop(HeadersTranslated[Indeks])</code> with <code>StartTheLoop(0)</code> e.g. in below:</p>
  
  <pre><code>let
     Source = Data_Cyrillic,
     #"Promoted Headers" = Table.PromoteHeaders(Source,[PromoteAllScalars=true]),
     #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Column1", type number}, ... , {"Column52", type number}}),
  
     StartTheLoop = (MyCounter)=&gt;
  
     let     
         #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{HeadersTranslated[HeaderList]{MyCounter}, HeadersTranslated[HeaderEnglish]{MyCounter}}})
     in
         #"Renamed Columns"
  in
     StartTheLoop(HeadersTranslated[Indeks])
  </code></pre>