The Alteryx Community is a finalist in three 2026 CMX Awards! Help us win Customer Support Community, Most Engaged Community, and User Group Program of the Year - vote now! (it only takes about 2 minutes) before January 9.
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Weighted median computation

akshatkumar87
Météore

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 RÉPONSES 8
pcatterson
Bolide
akshatkumar87
Météore

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
Bolide

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

akshatkumar87
Météore

Wonderful thanks a lot !!

pcatterson
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
Météore

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.

Étiquettes
Auteurs des meilleures solutions