PDA

View Full Version : Calculate Multiple Columns by Another



dalex
2016-07-27, 10:11 PM
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

Bill Szysz
2016-08-02, 04:12 PM
There are many ways to do this... here is one of them

Regards

dalex
2016-08-04, 10:11 PM
I only have the option to save this as a PHP file.. I'm not familiar with this format. Any pointers?

Bill Szysz
2016-08-04, 10:58 PM
I do not understand, this is just Excel file. What is wrong with it?

dalex
2016-08-05, 12:18 AM
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.

KathyKardynalski
2016-08-16, 02:02 PM
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.

Ken Puls
2016-08-23, 06:06 PM
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.

Yes, this is an issue with the board software and is on the list to fix.