Power Query add two columns with a null value

millhouse123

Active Member
Joined
Aug 22, 2006
Messages
335
I have a data set and I am trying to simply add to columns together, both columns are decimal type. Some of the values are null in one column or the other and no matter what I have tried the sum always returns a null value in the calculated column for those rows with null values in one column.

I have tried replacing all null with 0 and I have tried writing a formula so it only includes the non null value in the formula.

Any ideas to solve this would be much appreciated.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try this formula replacing Col1 and Col2 with your column/field names.

(if [Col1]=null then 0 else [Col1])+(if [Col2]=null then 0 else [Col2])
 
Upvote 0
Just use List.Sum:

Code:
= Table.AddColumn(Source, "Addition", each List.Sum({[Number1],[Number2]}), type number)
 
Upvote 0
There's several ways to approach it. You could try replacing nulls, using error handling, or using List.Sum.

Hope this helps:
 
Upvote 0

Forum statistics

Threads
1,223,991
Messages
6,175,820
Members
452,672
Latest member
missbanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top