Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Sum Total Issue - NULL ?

ChrisMcN
7 - Meteor

Hi

 

I am having an issue with a total formula - I am trying to create a total column to sum 5 x columns of data - for 3 of the 20 rows I am getting 0 as the total unexpectedly.

 

I searched the forum and used the select function to ensure each of the subsidiary columns were "Double" - I also used data cleansing to ensure that blanks / 0 were replaced but still I am getting the nil values for these rows.

 

Would anyone have any ideas of how I might resolve ?

 

Thanks

 

Chris

18 REPLIES 18
JoshuaGostick
11 - Bolide

Could you show me how the data looks like just before the formula tool?

 

Thanks,

Josh

ChrisMcN
7 - Meteor

Attached is the excel output just before that formula - I just deleted the contents of the left most columns as they are private data - hope that helps ..

 

Thanks

 

Chris

JoshuaGostick
11 - Bolide

That's great!

 

The workflow attached should hopefully fix the issue.

 
 

Tracker Output.PNG

 

Thanks,

Josh

ChrisMcN
7 - Meteor

Thanks so much - that worked - might I ask what I did wrong ?

 

Chris

JoshuaGostick
11 - Bolide

Great, I'm glad to hear that!

 

Basically, Alteryx was adding the columns incorrectly because some of the columns contained null values. If you look at the picture of the excel file below, you can see how some columns just have empty values rather than 0s.

 

Tracker Output Data.PNG

 

Alteryx treats 0s and nulls differently. It can add 0s but not nulls. That's why when Alteryx tried to add the null values with other numbers in the Formula tool, it automatically outputted a null value. 

 

That was why the first two columns worked because it was adding two 0s. But when it tried to add the third column, it was adding a null value and therefore not outputting the correct value.

 

The way to solve this was to add the data cleansing tool before the formula tool and selecting Replace with 0. This replaces all the null values with 0s and ensures that the column does not contain any null values. Now, that there are no null values, the formula tool was able to correctly add the values.

 

Thanks,

Josh

ChrisMcN
7 - Meteor

Thanks again - I see my error now 

 

Chris

AdamWatson
7 - Meteor

Josh,

 

I hope your well.

 

What is the most efficient way in your mind to set any fields back to Null afterwards?

 

I only want to change back the ones that got amended within the data cleanse. The reason is 0 could actually be a relevant value in my case

JoshuaGostick
11 - Bolide

Hi @AdamWatson,

 

Sorry I didn't reply earlier. Was enjoying the holidays!

 

I think in this scenario I would probably use a multi-field formula tool to create new fields without the nulls. Then, this would allow you to have a field which you can make calculations on and another field which identifies whether that value was a 0 or a null.

 

For example, something like this:

 

JoshuaGostick_0-1577981436717.png

 

Unfortunately, this may increase the number of fields significantly but it's the best option I can think of at the moment.

 

 

Thanks,
Josh

AdamWatson
7 - Meteor

No problem, glad you enjoyed the holidays.

 

Good idea thanks for you help.

Labels
Top Solution Authors