Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
abhishekpati86
Helper III
Helper III

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.

 

Capture.JPG

 

I am using the above code and getting an error. Is there any other way to do the same ?

 

Thanks,

AB

1 ACCEPTED SOLUTION
Anonymous
Not 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:
 Capture.PNG

 

Capture2.PNG

 

Notice: if your columns’ type not Numeric types, you should convert it to Numeric types before above steps.

 

Capture3.PNG

 

In addition, you can also use Number.FromText function to convert the string to Numeric.


Regards,
Xiaoxin Sheng

View solution in original post

5 REPLIES 5
fra123
New 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

Anonymous
Not 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:
 Capture.PNG

 

Capture2.PNG

 

Notice: if your columns’ type not Numeric types, you should convert it to Numeric types before above steps.

 

Capture3.PNG

 

In addition, you can also use Number.FromText function to convert the string to Numeric.


Regards,
Xiaoxin Sheng

BhaveshPatel
Community Champion
Community Champion

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

 

M11.PNGM10.PNGM12.PNGM13.PNG

 

 

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. 

 

 

 

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Very nice Solution and much more sofisticated! Smiley Happy @BhaveshPatel

Jaderson Almeida
Business Coordinator
ankitpatira
Community Champion
Community Champion

@abhishekpati86 It should be simple as = [column1] + [column2]

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.