• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sum function

Kishore_C

New Member
Hi..
using power query editor, I need a formula to calculate sum of data.
for example: I have data from cell O2:W400, Where I need to insert a new column with header name "total balance" for each row, say total of first row, O2:W2 and so on till end in new custom column. Once I got the total, I want to remove these columns by using remove column function and keep only new column created with balance.
 

Attachments

  • Power Query- Sum function.xlsx
    34.1 KB · Views: 5
Your source file is not included in your workbook. Cannot access your Mcode nor the original data. My best guess of what you want is

Code:
= Table.AddColumn(Last Step Name, "Sum", each List.Sum({[Col2], [Col3], [Col4], [Col5]}), Int64.Type)

where you replace col2, col3 etc with your column names.
 
Last edited:
Hi Alan,
Please find the source code file, i have tried the formula and throwing error, had to remove it.
 

Attachments

  • Power Query- sum.xlsx
    41.1 KB · Views: 5
Your source data doesn't have any columns named like
"121 to 150 days past due (Home Currency)",
"151 to 180 days past due (Home Currency)",
only "Amt 1", "Amt2", "Amt3" etc.

2 Things:
If your data did contain those column headers it would work as it is (tested here), with the proviso that:
You don't straightaway delete the column you've just created!
 
Back
Top