Calling all Alteryx customers: Refer your colleague to try Alteryx and receive a $50 gift card. Sign up now!
Free Trial

Alteryx Designer Desktop Discussions

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

How to group/rank data with a unique ID

Shaskel
5 - Atom

I am looking at a list of companies and ranking them based on # of employees.  

However, these companies have several different lines of business in various industries and may operate both nationally and internationally. 

Luckily, even if the companies are listed several times in several different ways, I can connect them by a unique ID.

 

This is my starting point:

RankingUnique IDCompany Name# EmployeesNational/InternationalIndustry
1001Company A               500,000NationalHealthcare
2003Company C               450,000InternationalFinancial Services
3002Company B               400,000NationalReal Estate
4004Company D               350,000NationalHealthcare
5006Company F               300,000NationalRetail
6001Company A               250,000InternationalPharmacy
7004Company D               200,000NationalBiotech
8002Company B               150,000InternationalFinancial Services
9003Company C               100,000InternationalBanking
10001Company A                 50,000NationalRetail

 

I intend to rank them by their primary (biggest) businesses, but also show their secondary businesses (and possibly third, etc.) in different columns, but all on the same row.

I have tried using the Summarize tool to concatenate the company names and other aspects, and group by unique ID.  Right now, the # of employees is summed, but I would like it separated out for each line of business.

 

This is what the data currently looks like:

RankingUnique IDCompany Name# EmployeesNational/InternationalIndustry
1001Company A, Company A, Company A               800,000National, International, NationalHealthcare, Pharmacy, Retail
2003Company C, Company C               550,000International, InternationalFinancial Services, Banking
2002Company B, Company B               550,000National, InternationalReal Estate, Financial Services
2004Company D, Company D               550,000National, NationalHealthcare, Biotech
3006Company F               300,000NationalRetail

 

This is my desired end result:

RankingUnique IDCompany Name (Primary Business)# EmployeesNational/InternationalIndustryCompany Name (Secondary Business)# Employees (Secondary Business)National/International (Secondary Business)Industry (Secondary Business)Company Name (Tertiary Business)# Employees (Tertiary Business)National/International (Tertiary Business)Industry (Tertiary Business)
1001Company A               500,000NationalHealthcareCompany A                 250,000InternationalPharmacyCompany A                    50,000NationalRetail
2003Company C               450,000InternationalFinancial ServicesCompany C                 100,000InternationalBankingNullNullNullNull
3002Company B               400,000NationalReal EstateCompany B                 150,000InternationalFinancial ServicesNullNullNullNull
4004Company D               350,000NationalHealthcareCompany D                 200,000NationalBiotechNullNullNullNull
5006Company F               300,000NationalRetailNullNullNullNullNullNullNullNull

 

Please let me know the most efficient way to get here.  Right now I am thinking of converting the # Employees column to a string (currently a double), concatenating it, then using Text to Columns to separate it out.  However, I would need to do several columns at once.  

 

Any/all advice is appreciated.  Thank you!

2 REPLIES 2
binuacs
21 - Polaris

@Shaskel one way of doing this

image.png

apathetichell
19 - Altair

tile tool unique value - unique id. use formala tool to rename 

[Name] as

if [Tile_Sequence_Number]>1 then [Name] + tostring([Tile_Sequence_Number]) else [Name] endif - feel free to add another formula tool with a switch command to switch 2 to secondary, 3 to third, etc. - whatever - that's on you.

filter tool -> get ride of the sequence numbers beyond the part you want.

 

now cross tab - primary keys are unique id/company name - name is your cross tab column - value is your value. concatenate or sum your values. 

 

Labels
Top Solution Authors