Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

SPLIT DATA USING A SPECIFIC COLUMN AND ADD COLUMN NAMES

Shahas
8 - Asteroid

Hi All,

 

I have a situation where in I have to group data by country and after each country is over, a separate header has to be given when a new country name begins.

 

for eg : 

 

IDNAMECOUNTRY
12ABAUS
35CDIND
64LEAUS
78OIIND
95FGSUI
21LFSUI
65POUK
17LQUK

 

This data has to look like : 

 

IDNAMECOUNTRY
12ABAUS
64LEAUS
IDNAMECOUNTRY
35CDIND
78OIIND
IDNAMECOUNTRY
95FGSUI
21LFSUI
IDNAMECOUNTRY
65POUK
17LQUK

 

Hope its clear.

 

Thanks in advance

10 REPLIES 10
ShankerV
17 - Castor

Hi @Shahas 

 

One way of doing this.

 

ShankerV_0-1682081458392.png

 

Many thanks

Shanker V

Shahas
8 - Asteroid

Heyy @ShankerV 

 

Thank u for the response

 

Could u please upload the flow?

binuacs
20 - Arcturus

@Shahas One way of doing with the batch macro

 

binuacs_0-1682081733794.png

 

ShankerV
17 - Castor

Hi @Shahas 

 

Step 1: Input

 

ShankerV_0-1682081818074.png

 

Step 2: 

 

ShankerV_1-1682081835752.png

 

ShankerV_2-1682081843325.png

 

 

Step 3:

 

ShankerV_4-1682081881608.png

 

 

ShankerV_3-1682081869792.png

 

 

Step 4:

 

ShankerV_5-1682081897797.png

ShankerV_6-1682081905623.png

 

Step 5:

ShankerV_7-1682081930970.png

 

ShankerV_8-1682081957139.png

 

 

Step 6:

 

ShankerV_9-1682081977576.png

RowCount <= [Tile_SequenceNum]

 

ShankerV_10-1682081985979.png

 

 

ShankerV
17 - Castor

Hi @Shahas 

 

Step 7: 

 

ShankerV_0-1682082059428.png

IF [RowCount]=2
THEN [Field1]
ELSE [Source_Field1]
ENDIF

 

ShankerV_1-1682082065762.png

 

Step 8:

 

ShankerV_2-1682082090828.png

ShankerV_3-1682082099269.png

 

 

Step 9:

 

ShankerV_4-1682082118634.png

 

ShankerV_5-1682082127333.png

 

Step 10:

 

ShankerV_6-1682082155008.png

 

ShankerV_7-1682082243955.png

 

Many thanks

Shanker V

Shahas
8 - Asteroid

@ShankerV thanks for the effort put in to post everything. 

 

A small doubt.. At step 7, formula's are being applied to source field. In the example I provided there are only 3 source fields. But in my actual data, there a lot more. So do I have to apply formula to every columns?

 

Thanks & Regards

Shahas Ahamed

Shahas
8 - Asteroid

@binuacs  Thank u for the response.

 

But when  run the flow, I'm getting a lot of duplicates.

 

In my data, there are 39 countries in total. In the macro section, we are giving 1 country name right in filter ? and what will we do for the false part?

 

Thanks & Regards

Shahas Ahamed

ShankerV
17 - Castor

Hi @Shahas 

 

Yes, as per the sample provided I have applied the formula to all 3 fields.

 

If in the original input, if you have more columns, then the formula should be applied to all the columns.

 

Many thanks

Shanker V

ArtApa
Alteryx
Alteryx

Hi @Shahas - Here is a possible solution:

 

ArtApa_0-1682316757943.png

 

Labels