Forum Discussion
How to use expression (x,y,z)
Sorry but I need tobother you again.
I am experimenting different solution as I am on the learning curve of Power Query.
I have now this custom function:
(
Input_Table as table,
InputColumnToChange1 as text
) =>
let
List = Input_Table[InputColumnToChange1],
NewTable = Table.ReplaceValue (
Input_Table,
each [List],
each if [List] = "Bronze"
then "StSt 316L"
else [List],
Replacer.ReplaceText,
{List}
)
in NewTable
I invoke it in this way :
let
Source = #"Query1 (2)"(Summary_Volumes, "Body_Material")
in
Source
What I would like to do is to change the values from"Bronze" to "StSt 316L".
However I got this error:
Many thanks to all of you helping me.
This is a wonderful place to learn.
Why do you need another function?
Replace body of your function with this (as you can see I haven't used let in block because it is not necessary if ther is only 1 step).
(inputTable as table, InputColumnToChange1 as text)=>
Table.ReplaceValue(inputTable, "Bronze", "StSt 316L", Replacer.ReplaceText, {InputColumnToChange1})
If you can provide sample data in usable format and expected result based on sample data, maybe we can create whole query for you.
- Mic19791 year agoPost Partisan
My target is to have multiple steps, as written here:
(
Input_Table as table,
InputColumnToChange1 as text,
InputColumnToChange2 as text
) =>let
List1 = Input_Table[InputColumnToChange1],
List2 = Input_Table[InputColumnToChange2],NewTable1 = Table.ReplaceValue (
Input_Table,
each [List1],
each if [List1] = "Bronze"
then "StSt 316L"
else [List1],
Replacer.ReplaceText,
{List1}
),NewTable2 = Table.ReplaceValue (
NewTable1,
each [List2],
each if [List2] = "Bronze"
then "StSt 316L"
else [List2],
Replacer.ReplaceText,
{List2}
)in NewTable2I want to invoke them in this way:
let
Source = #"Query1 (2)"(Summary_Volumes, "Body_Material", "Stuffing_Box_Material")
in
Sourcebut I don't understand why I have the error message:
Could you support me on the error?
Thanks.