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.
SOLVED

Replace NULL by with the Median Grouped by another Variable

phil_budden
8 - Asteroid

Hi All,

 

I'm trying to replace the NULL values in one of my variables by the Median of that variable when grouped by another variable.

 

For example, imagine I have the following dataset - I want to replace the missing age values by median of all ages with the same title.

 

TitleAge
Master10
Master14
Master3
MasterNULL
Mrs26
Mrs52
Mrs45
MrsNULL
Mrs76

 

I can accomplish this using a series of filters connected to imputes then reconnected via a union but was hoping there was a more elegant solution.

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus
How about summarizing the data with appropriate Group by titles. You can then join the summary median to the original data by title. Then a formula can be used.

IIF(isnull(value),median_slug,value)

That's what I'd do.
Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
phil_budden
8 - Asteroid

Great, thanks Smiley Happy

rb1
5 - Atom

Is there a way to do this with multiple columns simultaneously? I have around a hundred columns for which I'd like to replace null values with the grouped-by median values, and I'd like to not have to create 100 formulas.

Labels
Top Solution Authors