omezquita
New member
- Joined
- Apr 1, 2016
- Messages
- 19
- Reaction score
- 0
- Points
- 0
- Website
- www.masterdataanalysis.com
- Excel Version(s)
- 2016
Hi,
I have the following line of code that assigns the data type for each column.
I would like to convert the query to a function and apply it to different tables that will have the same number of columns but different column names. Is there a way to refer to the columns by their position rather than their name?
Something like:
I know that I could demote the headers and then do something like:
But I would like to know if there's a way without the additional step.
Thanks!
I have the following line of code that assigns the data type for each column.
Code:
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {"Jan 2016", Int64.Type}, {"Feb 2016", Int64.Type}, {"Mar 2016", Int64.Type}}),[FONT=arial, sans-serif] [/FONT]
I would like to convert the query to a function and apply it to different tables that will have the same number of columns but different column names. Is there a way to refer to the columns by their position rather than their name?
Something like:
Code:
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Product", type text}, {2, Int64.Type}, {3, Int64.Type}, {4, Int64.Type}}),[FONT=arial, sans-serif] [/FONT]
I know that I could demote the headers and then do something like:
Code:
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", Int64.Type}, {"Column3", Int64.Type}, {"Column4", Int64.Type}}),[FONT=arial, sans-serif] [/FONT]
But I would like to know if there's a way without the additional step.
Thanks!