Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
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"
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
Thanks for the resonse smoupre.
I will try this. Do I put this code below my original code or replace?
R
| User | Count |
|---|---|
| 50 | |
| 40 | |
| 32 | |
| 14 | |
| 13 |
| User | Count |
|---|---|
| 83 | |
| 71 | |
| 37 | |
| 27 | |
| 24 |