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

Counting a sub category within a larger category

sbarrett
5 - Atom

I have a data set where I am recording information for individual items.  Each item has a lot number and a severity level (A, B, N/A).  I would like to calculate a third column to trend the total number severity B item per lot as well as a forth column to trend the total number of severity A items per lot.  Is there some kind of for loop that I can use in combination with an if statement to count the number of severity a and b items per lot?

 

Example of my data set: 

Lot NumberSeverityTotal Sev B per lotTotal Sev A per lot
A40199N/A  
A40200N/A  
A40201N/A  
A40205N/A  
A40206A  
A40206B  
A40207B  
A40207B  
A40208B  
A40208B  
A40209B  
A40209B  
A40210N/A  

 

Example of how i want my data set:

Lot NumberSeverityTota Sev B per lotTotal Sev A per lot
A40199N/A 0 0
A40200N/A 0 0
A40201N/A 0 0
A40205N/A 0 0
A40206A1 1
A40206B 1 1
A40207B 2 0
A40207B 2 0
A40208B 2 0
A40208B 2 0
A40209B 2 0
A40209B 2 0
A40210N/A 0 0
2 REPLIES 2
JohnJPS
15 - Aurora

Hi @sbarrett,

One easy way is to Cross-Tab, then Multi-Field formula on the specific fields of interest, then join back to the original data set; (see attached).

Capture.PNG

sbarrett
5 - Atom

This worked! I appreciate your help, thank you.

Labels
Top Solution Authors