Through researching the internet I was able to find a shortcut to change all the columns, except a given number of columns from the left, to the same type thus making it dynamic. For example, if I wanted to change all the columns except the first two to a type number I can enter the following formula: = Table.TransformColumnTypes(#"Previous Step",List.Transform(List.Skip(Table.ColumnNames(#"Previous Step"),2), each{_, type number}))
I wanted to apply this technique to other operations. Currently I would like to divide all columns except the first two by 100. The table may continually add new columns with new data available so I would like to make M code dynamic. Applying the previous formula I would think this code would work: = Table.TransformColumnTypes(#"Previous Step",List.Transform(List.Skip(Table.ColumnNames(#"Previous Step"),2), each{_ / 100, type number}))
However it doesn't and I would like to know why and how to fix this error. Is there a universal way to reference all the columns except a select few that I can just plug?
I wanted to apply this technique to other operations. Currently I would like to divide all columns except the first two by 100. The table may continually add new columns with new data available so I would like to make M code dynamic. Applying the previous formula I would think this code would work: = Table.TransformColumnTypes(#"Previous Step",List.Transform(List.Skip(Table.ColumnNames(#"Previous Step"),2), each{_ / 100, type number}))
However it doesn't and I would like to know why and how to fix this error. Is there a universal way to reference all the columns except a select few that I can just plug?