Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

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

Concatonate Rows and select Columns

davidgosselin
6 - Meteoroid

Hello, 

It would be great if someone could help me with a question for my data set. As you can see in my sample file, I have a data set with to header rows. The only columns I need are the ones where the second header is 'Reporting Total' for each countries. One thing that I have tried to use to help me is that for every country, the data that I want('Reporting total') is the fifth row from the country. 

I have search various different ways of doings this but I haven't found a way since I have 200 countries and don't want to manually select all of them for each files of data I have.

Also, I would like to delete de second row as it is not needed once I have the columns selected('reporting total')

 

It would be very appreciated if someone could help me.

 

Thank you in advance,

7 REPLIES 7
grossal
15 - Aurora
15 - Aurora

Hi @davidgosselin,

 

I got you!

 

Workflow:

grossal_0-1585427442857.png

 

Output:

grossal_1-1585427452047.png

 

What happens:

1) Shift all columns (other than first) to rows (Transpose)

2) Filter all rows with "Reporting Total"

3) Join all rows based on the names of the "Reporting Total" rows back together

4) Remove the numbers from the Country names (Data Cleansing)(they get numbers, because of the Transpose tool)

5) Shift them back to columns (Cross Tab)

 

 

Worfklow is attached. Let me know if this solved the problem.

 

Best

Alex

AbhilashR
15 - Aurora
15 - Aurora

@davidgosselin - Attached is my attempt to retain only the Reporting Total columns. Hope this helps.

AbhilashR_0-1585428567344.png

 

davidgosselin
6 - Meteoroid

Thank you Alex for your quick response ! 

 

It almost solves my problem completly.

 

I have one more issue:

-When we remove the numbers from the "country names", this creates an issue for me since the so call "Country Names" are not countries in my data input, but entities. The problem I have when I remove the numbers automatically given is that another problem I have in my workflow is that i want to keep only certain Entities. The entities I would like to keep are the ones containing numbers in their name since they are the only relevant ones.

 

In summary: I have hundreds of entities, the only ones I want to keep are the ones that have numbers in them(which I am not sure how to do) and if I remove the numbers it will be hard for me to find a way to keep the ones with numbers in them.

 

For example:

I would like to keep the entity(and its entire column with data) with the name: Entity12holding

I would like to discard the entity(and its entire column with data) with the name: Entityholding

 

I reuploadeed my sample and desired output and included a number so that it is more clear what i would want.

 

Thank you for your time,

grossal
15 - Aurora
15 - Aurora

I think I fixed it @davidgosselin.

 

grossal_0-1585430514382.png

 

I replaced the Data Cleansing Tool with a formula and use a Regex_Replace function to remove the last number and an _ before it.

 

Workflow attached.

 

 

Best

Alex

davidgosselin
6 - Meteoroid

Thank you so much! And the last thing, do you know how I could filter to only keep the entities who have numbers in them? In my sample, I would only keep Canada1(the numbers are not always at then end of the entities names) so I would need to find a way to filter if there is a number or not in the name

 

Thank you for your time,

 

Dave

grossal
15 - Aurora
15 - Aurora

Oh sorry, I read over that.

 

grossal_1-1585431870623.png

 

 

I added a Filter with a Regex_Match for getting only the columns with at least one number in it. Workflow attached.

 

I am happy to help.

 

Alex

davidgosselin
6 - Meteoroid

Thank you!

Labels
Top Solution Authors