'Powerquery: passing column value to custom function

I'm struggling on passing the column value to a formula. I tried many different combinations but I only have it working when I hard code the column,

(tbl as table, col as list) =>
let 
    avg = List.Average(col),
    sdev = List.StandardDeviation(col)
   
in    
    Table.AddColumn(tbl, "newcolname" , each ([column] - avg)/sdev)

I'd like to replace [column] by a variable. In fact, it's the column I use for the average and the standard deviation.

Please any help. Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source