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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Simple SUM of two columns not working (only null values returned)

Hi,

 

I am having a strange problem in the query editor (in Power BI). I want to add a new column that is the SUM of two columns in the same table:

Imagen 6.png

 

Imagen 7.png

 

 

It's really strange, if the formula for PASok is just a SUM of the other 2 columns that have some values, how can the new column only return null values? any idea what can be going on here?

 

Thank you very much

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The + operator is returning a null because the [PAS] field is null ( number + null = null). This behavior is standard for all operators within PQ (+,-,/,*) and sql. You can override this behavior with List.Sum. List.Sum ignores nulls by definition.

 

List.Sum( { [Services Proactive], [PAS] } )

View solution in original post

4 REPLIES 4
dufoq3
Super User
Super User

This could be achieved simply by coalesce operator ??

 

dufoq3_0-1710066101414.png

let
    Source = #table(type table[A=number, B=nullable number], List.Zip({ List.Transform(List.Random(20,1), each Number.Round(_, 2) * 100) , List.Repeat({null}, 20) })),
    Ad_Sum = Table.AddColumn(Source, "Sum", each [A] + ([B] ?? 0), type number)
in
    Ad_Sum

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Anonymous
Not applicable

The + operator is returning a null because the [PAS] field is null ( number + null = null). This behavior is standard for all operators within PQ (+,-,/,*) and sql. You can override this behavior with List.Sum. List.Sum ignores nulls by definition.

 

List.Sum( { [Services Proactive], [PAS] } )

Thanks!

Anonymous
Not applicable

Ok, thank you very much.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors