Alteryx Designer Desktop Discussions

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

Combining multiple rows of data into one with conditions

ltensmeyer
8 - Asteroid

So this question isn't as simple as it sounds. I have a list of patients and their medical insurance claims along with the description of their problem. What I need to do is go through all of this data and find each individual's top 2 conditions which they've made claims for. I've already used the summarize tool to count how many times each patient has made claims for the same problem. What i'm left with is something like this sample:

Last nameFirst nameDOBDiagnosisDiagnosis count
DoeJane1/1/2000Asthma27
DoeJane1/1/2000Depression22
DoeJane1/1/2000Covid1
DoeJane1/1/2000Infection1
SmithJohn1/5/2000Sleep Apnea13
SmithJohn1/5/2000Unspecified Pain2
SmithJohn1/5/2000Prescriptions2
TankThomas1/3/2000Unspecified Pain2
 
 

The result I need would be something like this:

Last name First name  DOB  Primary Diagnosis Secondary Diagnosis     Notes

DoeJane1/1/2000AsthmaDepressionOther diagnosis: Covid, infection
SmithJohn1/5/2000Sleep ApneaUnspecified painOther diagnosis: Prescription
TankThomas1/3/2000Unspecified painNullNull

 Any ideas are appreciated! (The notes section is ideal but isn't required, the two diagnosis are the more important part).

 

5 REPLIES 5
binuacs
21 - Polaris

@ltensmeyer One way of doing this

image.png

ScottAMccoy
5 - Atom

So, the best way I found to accomplish this is to Use another Summarize and to Group By Last Name, First Name, and DOB with a Concatenate on the Diagnosis. Then split the Diagnosis to separate columns, via a Text to Column with the number of columns set to 3 and Extra characters set to Leave extra in last column. Other methods using Cross Tab might also work but could run into issues with the Notes column. After that I just added a Formula to add in the "Other diagnosis:" when there existed more than two. A Select at the very end cleans up the extra column and rename columns to those in your example output.AlteryxCommunity1.png

ltensmeyer
8 - Asteroid

This looks great! I'm having trouble opening your file but I might be able to recreate it just based on your description.

ltensmeyer
8 - Asteroid

@binuacs Thank you! My actual dataset has about 500 patients and I'm not sure if I can get them all organized enough for this method to work but I'm trying it now!

Paridhi_Agrawal
8 - Asteroid

Hi,

Check the attached workflow if it helps.

 

 

Labels
Top Solution Authors