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

Conditional data manipulation using alteryx

akshatkumar87
7 - Meteor

Hey Guys,

 

I have a data set where i need to do manipulation based on various columns. I i need to get weighted average of Access_score over lives if sum lives!=0 and weighted average over TRx of Access_score if sum lives=0 and 'Trx' as unique of each value grouped by IMS_ID & IMS_PLAN_ID

 

Input data

 

IMS_IDIMS_PLAN_IDPLAN_IDIMS STATEPLAN STATEACCESS_SCORELivesTrx
2222341234CACA203
222234678CACA403
2222351234CACA210004
222235678CACA42004
3332341234CACA205
333234678CACA405
3332351234CACA210006
333235678CACA42006

 

Output data

 

IMS_IDIMS_PLAN_IDACCESS_SCORE
2222343
2222352.333
3332343
3332352.333

 

I am thinking of using mutifield formula but not sure how to manipulate multiple columns grouping by multiple columns

 

Thanks in advance

7 REPLIES 7
RodL
Alteryx Alumni (Retired)

I'm thinking you can just filter on your conditions and then use the Weighted Average tool (in the Transform category) for each side of the Filter tool and then Union them back together?

michael_treadwell
ACE Emeritus
ACE Emeritus

Basically doing what @RodL stated. Check the attached workflow.

jdunkerley79
ACE Emeritus
ACE Emeritus

I tried using a summarise tool to get sum of lives, then filter to split in two taking it through the Weighted Average macro. Finally union back together.

2016-06-03_17-57-22.jpg

 

Sample attached

 

(same as @RodL and @michael_treadwell I think!)

akshatkumar87
7 - Meteor

Thank you everyone for your help much appreciated.

akshatkumar87
7 - Meteor

Can you upload the version for 10.1 cannot open yours ?

jdunkerley79
ACE Emeritus
ACE Emeritus

@akshatkumar87 Try the attached 

akshatkumar87
7 - Meteor

Thanks a lot

Labels