Forum Discussion
Mederic
Post Patron
3 years agoReplace Index Column by others values
Hello all, I have an Index column as shown below (1) : And I would like to replace the values by the following result in Power query (2) : Thank you in advance Best regards (1) Index
1
2
3
...
Mederic
Post Patron
3 years agoHello,
This code seems to work,
If you have another solution, I'd be grateful
Best regards
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Index", Int64.Type}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type",each [Index], each try if
Number.IsEven([Index]) then 2 else 1 otherwise null, Replacer.ReplaceValue,{"Index"})
in
#"Replaced Value"