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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,224,959
Messages
6,182,001
Members
453,082
Latest member
PurpleParks

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