Forum Discussion
Custom Function to multiply Columns
- 2 years ago
Hi Mic1979, you are making things complicated - this is not the first time. I've helped you also last time - but you ignored my solution. I give you one more try 😉
Before
After
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcvR1DfJ0dgxW0lEyNAASpgZgFog00DEEk6ZKsTrUUmgEJs2UYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Ragion = _t, TOTAL_A = _t, SOME_VALUE = _t, TOTAL_B = _t, #"% INTRODUCTION COEFFICIENT" = _t, #"%" = _t]), ChangedType = Table.TransformColumnTypes(Source,{{"TOTAL_A", type number}, {"SOME_VALUE", type number}, {"TOTAL_B", type number}, {"% INTRODUCTION COEFFICIENT", type number}, {"%", type number}}), RenamedColumnsDynamic = Table.TransformColumnNames(ChangedType, each Text.Replace(_, "TOTAL", "SMOOTH")), MultipliedSmoothColumns = Table.ReplaceValue(RenamedColumnsDynamic, each [#"% INTRODUCTION COEFFICIENT"] * [#"%"], null, (x,y,z)=> x * y, List.Select(Table.ColumnNames(RenamedColumnsDynamic), (x)=> Text.StartsWith(x, "SMOOTH")) ), RestoredTypes = Value.ReplaceType(MultipliedSmoothColumns, Value.Type(RenamedColumnsDynamic)) in RestoredTypes
To make it easier to assist you, please provide a representative data sample (with confidential information obfuscated) as text that can be copy/pasted, and also a screenshot (or text table) of your desired results from that data.
My target is to have a function to pass from the first table to the second one, multypling all the column with the last two ones ("Introduction_Rate" and "Step_Split").
Here you have the scrrenshot.
.
The second table is has empty columns because I have errors in the function.
Hoping this clarifies.
Many thanks.
- ronrsnfld2 years agoSuper User
For some reason, you chose to post neither item I requested. And what you did post is not helpful to me. Hopefully someone else will be able to assist you.