Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Totaling Samples per Month based on an Average

sbarrett
5 - Atom

I have a data set where individual samples failures from particular lots are recorded as individual rows.  Each failure has partilar columns for lot#, severity, sample size, and month.  I would like to add a column for total samples tested per month.  I cannot simply sum the samples sizes because there are sometimes multiple rows entered per lot.  Instead, I must average the sample sizes per lot and then sum those averages.  I was thinking of using the cross tab and the multi-field tool but I am having trouble with the correct expression to use.  Can someone offer some advice?   below is an example of what I am looking to do.  

 

This is what i currently have:

LotSample SizeSeverityTest Month
A1400AJan
A1400BJan
A1200N/AJan
A2200N/AJan
A3200BFeb
A3200BFeb
A3200BFeb
A4200BFeb
A5200N/AMarch
A6200BMarch
A6200BMarch
A7200N/AMarch

 

This is what I look like to have:

LotSample SizeSeverityTest MonthTotal Samples per Month
A1400AJan600
A1400BJan600
A1400N/AJan600
A2200N/AJan600
A3200BFeb400
A3200BFeb400
A3200BFeb400
A4200BFeb400
A5200N/AMarch600
A6200BMarch600
A6200BMarch600
A7200N/AMarch600
2 REPLIES 2
Joe_Mako
12 - Quasar

How about the attached workflow?

 

It uses Unique to select a single record per Lot-Month combination, then Sums Sample Size to the Month granurality, and joins the aggregrated value back in with your original data.

 

Total Samples per Month

sbarrett
5 - Atom

This is perfect! Thank you!

Labels
Top Solution Authors