Forum Discussion
Multiple Transformations on a Column of Tables - Power Query
- 5 years ago
Hi, Anonymous , please check if this is what you need.
you have a table, each row of the column "Custom" is a able, like below picture:
You need to do transformation of each row like:
= Table.TransformColumns(Custom1,{"Custom",each Table.ReplaceValue(_,0,0,(x,y,z)=>if Text.Contains(x," ") then "R0."&Text.Split(x," "){1} else x,{"Column1"})})
Hello Anonymous
you have to use a nested Table.TransformColumns... here some code that you have a idea how it looks like
Table.TransformColumns
(
PreviousStep,
{
{
"Custom",
(tbl)=> Table.TransformColumns(tbl, {{"Column1", each if _ = "seg." then "R.01" else it... etcetc....
}
}
for the second Table.TransformColums you could also use a Table.ReplaceValue
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
- Anonymous5 years agoNot applicable
Tried this:
= Table.TransformColumns( [Custom] {{"Column1", (tbl) => Table.TransformColumns(tbl, {{"Column1", each if Text.Contains(_ , "segment", Comparer.OrdinalIgnoreCase) then "R.01" & _ else _}})}} )got this error:
Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?- Jimmy8015 years agoCommunity Champion
Hello Anonymous
there are to errors in. The table in your first TransformColumns has to be a table.. in your case the name of your previous step, and the second error is that the "," is missing after the reference. Change this two and everything should be fine
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy