Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Calculate Average of Multiple Rows Where Some Are Populated With "n/a"

Rob48
8 - Asteroid

Having a difficult time with this one.  It's very easy in excel so I assume it's easy in Alteryx and I just don't know the trick. I'm trying to average out the values in combined columns, but some of the cells are populated with text if there is no value.   in the example below I need to get an average for each category for column 1, column 2, columns 3&4 combined, and columns 5&6 combined.

 

My data looks like this:

 

 

CategoryNumber1Number2Number3Number4Number5Number6
Cat1333333
Cat234431n/a
Cat333333n/a
Cat4333n/a33
Cat5223222
Cat433332n/a
Cat42243n/a3
Cat333333n/a
Cat4333n/a22
Cat522222n/a
Cat24444n/an/a
Cat3111311
Cat433332n/a
Cat5334n/an/a3
Cat1333333

 

 

 

I need it to look like this:

 

CategoryAvg  of Number1Avg of Number2Avg of Number3 & 4Avg of Number5 & 6
Cat13.13.23.02.9
Cat23.13.23.02.9
Cat33.13.23.02.9
Cat43.13.23.02.9
Cat53.13.23.02.9

 

 

Excel will just ignore the "n/a" values when calculating to the new columns for 3&4 and 5&6.  Alteryx won't calculate non-numbers (as far as I can tell) and if I convert those n/a text cells to zero I get another set of problems.   is there a simple trick I don't know about?  

 

 

 

6 REPLIES 6
Raj
16 - Nebula

Convert your N/A to 0 using  multi- Field Formula 

then you have a option to calculate average considering that cell or average ignoring 0's as well.

according to me this is easiest and effective way to  achieve the solution

Rob48
8 - Asteroid

I tried that and that's where I got stuck. How do i combine the values in columns 3&4 to average them?

cjaneczko
13 - Pulsar

You can add a formula tool that averages them ([Number 3] + [Number 4])/2 and ([Number 5] + [Number 6])/2.

 

or Average([Number 3],[Number 4]) and Average([Number 5],[Number 6])

Rob48
8 - Asteroid

 that won't eliminate the zeros.  (4+0) / 2 = 2.   

cjaneczko
13 - Pulsar

Replace the N/A's with 0's or blanks with a formula tool.

kamal03
9 - Comet

Hi @Rob48 ,

 

You can try the below workflow to get the desired output.

Let me know if it works for you or not.

rob48.png

 

Thanks

Labels
Top Solution Authors