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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.