Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
RAdams
Helper III
Helper III

Renaming Dynamic Column Names in Query Editor

I'm working on a personal project to track how I would do against some of the professional football game pickers. I'm using the website nflpickwatch.com. The issue I'm having is that the column names change as the picks are chosen. I've found the M code on Table Column renaming and I've tried to figure it out on my own but with no success. 

 

My question is, how do I rename the columns to something as simple as Column01, etc starting with the code below? It's nothing serious and any help would be appreciated but I mean, this is kinda fun to try out too! 

 

 

let
    Source = Web.Page(Web.Contents("http://nflpickwatch.com/?text=1")),
    Data = Source{0}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Data,{{"Consensus #", Int64.Type}, 
{"Consensus Name", type text}, {"KC @ NE NE 80% Picks", type text},
{"NYJ @ BUF BUF 80% Picks", type text}, {"ATL @ CHI ATL 80% Picks", type text},
{"BAL @ CIN CIN 80% Picks", type text}, {"PIT @ CLE PIT 80% Picks", type text},
{"AZ @ DET AZ 80% Picks", type text}, {"JAX @ HOU HOU 80% Picks", type text},
{"TB @ MIA TB 80% Picks", type text}, {"OAK @ TEN OAK 80% Picks", type text},
{"PHI @ WAS WAS 75% Picks", type text}, {"IND @ LAR - Picks", type text},
{"SEA @ GB GB 80% Picks", type text}, {"CAR @ SF CAR 80% Picks", type text},
{"NYG @ DAL DAL 80% Picks", type text}, {"NO @ MIN - Picks", type text},
{"LAC @ DEN DEN 80% Picks", type text}, {"Week W", Int64.Type}, {"Week L", Int64.Type},
{"Week %", Percentage.Type}, {"All Time Record W", Int64.Type},
{"All Time Record L", Int64.Type}, {"All Time Record %", Percentage.Type}}) in #"Changed Type"
2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

How about something like this?

 

let

    //list of original column names 
    List1= {"Name1","Name2","Name3","Name4"},

    //Create test table
    Source = Table.FromRows({{1231,1233,4121,5232},{3546,3426,1246,3464}} , List1),

    //list of new column names
    List2 = {"NewName 1","NewName 2","NewName 3","NewName 4"},

    Result = Table.FromRows(Table.ToRows(Source), List2)

in
    Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for the resonse smoupre. 

 

I will try this. Do I put this code below my original code or replace? 

 

R

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.