Sum only numeric columns with PQ

Nick Burns

Member
Joined
May 24, 2017
Messages
162
Reaction score
0
Points
16
Excel Version(s)
Office 365
Digging up this old thread - is there a way to total only columns that are numeric?

With this:
= Table.AddColumn(YourPreviousStep, "Sum", each List.Sum(Record.ToList(_)))

I get an error as some of my columns are text.
 
No problem, Nick :))
= Table.AddColumn(YourPreviousStep, "Sum", each List.Sum(List.Transform(Record.ToList(_), each if _ is number then _ else null)))
first _ is different than second _ :)))
 
@Nick


Please do not hijack existing threads but rather create a new one with eventually a link to any threads of interest. Older threads are not always visited by the members, and, as most of us look at thread titles to see if they can help, you might be depriving yourself, and other members of valuable help.

I created a new thread for you this time
 
Last edited:
Thanks Bill! Worked like a charm.

Pecoflyer - will do! I always search the forum in case my question has already been asked and figured my question was somewhat related to the other thread that I would just tag on to it. ;)
 
Back
Top