Forum Discussion
How to Sum columns in edit queries.
Hi All,
I have a very simple requirement to sum the below 3 score columns using custom column, can anyone please help me with that.
I am using the above code and getting an error. Is there any other way to do the same ?
Thanks,
AB
- Anonymous9 years ago
Hi abhishekpati86,
I agree with ankitpatira’s point of view, you can use the insert button to add column to instead of typing column names.
For example:
Notice: if your columns’ type not Numeric types, you should convert it to Numeric types before above steps.
In addition, you can also use Number.FromText function to convert the string to Numeric.
Regards,
Xiaoxin Sheng
5 Replies
- BhaveshPatel
Super User
Hi Abhishek,
You can use the newly added functionality Invoke Function for this and It would be more creative solution as you can use them for other type of tasks as well.
To do so,
1.Add a Blank query and Write the below code:
(Qscore as number, Rscore as number,Sscore as number) => Qscore + Rscore + Sscore
2. Go to your original query and Under the Add Column Tab, Select Invoke Custom Function.
and Choose the appropriate options and it will give you desire results.
- bajimmy1983
Advocate V
Very nice Solution and much more sofisticated! :smileyhappy: BhaveshPatel
- ankitpatira
Community Champion
abhishekpati86 It should be simple as = [column1] + [column2]
- AnonymousNot applicable
Hi abhishekpati86,
I agree with ankitpatira’s point of view, you can use the insert button to add column to instead of typing column names.
For example:
Notice: if your columns’ type not Numeric types, you should convert it to Numeric types before above steps.
In addition, you can also use Number.FromText function to convert the string to Numeric.
Regards,
Xiaoxin Sheng - fra123New Member
Hi There,
I am trying to replicate a simple Excel Step in Power Query, but getting into meny errors
Have a table wti the Following column: "P", "D", "S","N"
I want to add a new colums
Custom= Sum( P- (D+S) - N)
I have been trying wit List.SUM but I can't find the right sysntax. Hope you can help. I am not very confident with the Query Editor