Forum Discussion
Anonymous
6 years agoNot applicable
Replacing a column with calculation, performing a column lookup dynamically
Hi, I have a vendor file that has numbers that I need to normalize in order to display the correct results. The calculation I need to do is to pull in existing data, overwrite the score data based o...
- 6 years ago
Add a custom step with the following. Replace #"Changed Type" with the name of your last step (that is the default value when you add a custom step).
= Table.FromRecords(Table.TransformRows(#"Changed Type", each _ & Record.FromList(List.Transform(List.Select(Record.FieldNames(_), each Text.StartsWith(_, "Score_")), (name) => Record.Field(_, name) * Record.Field(_, "Weight_" & Text.AfterDelimiter(name, "Score_"))),List.Select(Record.FieldNames(_), each Text.StartsWith(_, "Score_")))), Value.Type(#"Changed Type"))
artemus
6 years agoMicrosoft Employee
Yea, this is an alternative solution that works on the base table. It won't do anything unless there are Score_# and Weight_# columns
Anonymous
6 years agoNot applicable
artemus That works! Thank you. This is exactly what I was looking for.
edhans thank you as well, I just needed it to happen on the same column but your solution will help me on another issue.
- edhans6 years agoCommunity Champion
Great Anonymous - glad you have the solution you needed!