Understanding how to make a dynamic range in combination with other M formulas

gjohal

New member
Joined
Nov 8, 2018
Messages
15
Reaction score
0
Points
0
Excel Version(s)
2016
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 don't know if the syntax is the same but try Table.TransformColumns instead of Table.TransformColumnTypes.

Norm
 
Thanks for the reply! I think the syntax might be different, I did a plug and replace and it didn't work.
 
Back
Top