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

Alteryx Designer Desktop Discussions

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

Weighted median computation

akshatkumar87
7 - Meteor

Hey guys i am trying to do wieghted median over two columns which is the best macro for the same ?

Used crew macro but getting into config trouble the macro works well but does not give the group by ids in the output. In the config i grouped by a column for ex. id and it has to calculate wieghted median for each of those id. The output does not show me the id just the weighted median values.

 

Output i got

 

weighted median

5
3
2.785714
4
3
4.208333

 

Desired output

 

Id        weighted median

   1                  5
   2                 3
   3          2.785714
   4                 4
   5                3
   6         4.208333

8 REPLIES 8
pcatterson
11 - Bolide
akshatkumar87
7 - Meteor

Thanks a lot the macro works well but does not give the group by ids in the output. In the config i grouped by a column for ex. id and it has to calculate wieghted median for each of those id. The output does not show me the id just the weighted median values.

 

Output i got

 

weighted median

5
3
2.785714
4
3
4.208333

 

Desired output

 

Id        weighted median

   1                  5
   2                 3
   3          2.785714
   4                 4
   5                3
   6         4.208333

 

Any clue ?

pcatterson
11 - Bolide

I made a small change to the inner workings of the default CREW macro.  That should do what you need.

akshatkumar87
7 - Meteor

Wonderful thanks a lot !!

pcatterson
11 - Bolide

i'm attaching a slightly improved version of the adapted weighted median macro.

jdunkerley79
ACE Emeritus
ACE Emeritus

Mostly for interest I tried to recreate the CReW Macro with a dynamic grouping input.

 

Lets you pick the columns to group by and returns the group names with the computed weighted median.

 

 2016-06-10_23-58-42.jpg2016-06-11_00-11-55.jpg

 

Details on how I made the macro are at https://jdunkerley.co.uk/2016/06/10/creating-user-controlled-groupings-in-a-weighted-median-alteryx-...

 

 

 

 

akshatkumar87
7 - Meteor

Can you reupload with the older version of Alteryx i cannot install this one because this was made on older version?

jdunkerley79
ACE Emeritus
ACE Emeritus

Try the attached.

Labels