Alteryx Designer Desktop Discussions

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

Calculating Average Excluding Zero Rows

Alteryxexpert
7 - Meteor

I have Data like below, for which i need to calculate average.

NameYearValue
Sales20230
Sales202310
Sales20230
Sales202315
Sales20240
Sales2024150
Sales20240
Sales2024300
Sales202550
Sales20250
Sales20250
Sales2025100

 

For Example: If I want to calculate AVG for 2024 the calculation should only pick (150+300)/2=225 not (150+300+0+0)/4=112.5, Is there a way to achieve this for all the line items? 

2 REPLIES 2
Alteryxexpert
7 - Meteor

Achieved Using summarize average Ignore 0's option

gawa
15 - Aurora
15 - Aurora

hi @Alteryxexpert 

To ignore the record in Summarize tool, value should be NULL. For example, replace the record which value is 0 with NULL, and go Summarize tool like this.

image.png

===========================================================

As a side note, this technique is also powerful when summarize string data. If some record are empty string and concatenate them, its result contains unwanted separator like

A,B,C,,E

image.pngimage.png

 

However, by converting empty string to NULL, result will be like this format that should be preferable in most cases.

A,B,C,E

image.pngimage.png

Labels