Calculate Multiple Columns by Another

dalex

New member
Joined
Jul 27, 2016
Messages
3
Reaction score
0
Points
0
Greetings, I'm looking for advice on a problem I believe is easily achievable with Power Query. I have multiple columns with values that represent a fraction, (.75, .2, .15, etc..) There are a few dozen columns of this nature representing different products. I also have a single column that I would like every other column multiplied by. This is simple to do by adding a calculated column for each product and multiplying by the fraction, but I'm wondering about automated solutions using m code. Any advice is appreciated.

Dataset looks like this:

Quantity Product 1 Product 2
30 0.75 0.25
40 0.50 0.50
50 0.25 0.50
60 0.30 0.60

Want it to calculate to this:

Quantity Product 1 Product 2
30 22.5 7.5
40 20.0 20.0
50 12.5 25.0
60 18.0 36.0
 
I only have the option to save this as a PHP file.. I'm not familiar with this format. Any pointers?
 
I was unable to download the xlsx file for some reason. On another computer it worked fine.. Mystery to me.

Thanks for posting your solution, it is much appreciated.
 
dalex, I had the same problem with "attachment.php" using the Internet Explorer browser. Switched to Chrome and the file downloaded as a spreadsheet as expected.
 
Back
Top