Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Fill down null rows of multiple columns with respective column values

aroy061987
6 - Meteoroid

I have the following input dataset:-

Field 1Field 2Field 3Field 4
Tes1Name1ID1Yes
   No
   Yes
Tes2Name2ID2Yes
   No
   Yes
Tes3Name3ID3Yes
   No
   Yes

 

I need output in this way:-

Field 1Field 2Field 3Field 4
Tes1Name1ID1Yes
Tes1Name1ID1No
Tes1Name1ID1Yes
Tes2Name2ID2Yes
Tes2Name2ID2No
Tes2Name2ID2Yes
Tes3Name3ID3Yes
Tes3Name3ID3No
Tes3Name3ID3Yes

 

I can fill down each column one by one with multirow formula, but I have around 40 such columns which needs to be filled down. How can I achieve the same without adding 40 multi-row formula tool.

9 REPLIES 9
ShankerV
17 - Castor

Hi @aroy061987 

 

One way of doing this.

 

ShankerV_0-1686905124968.png

 

Many thanks

Shanker V

aroy061987
6 - Meteoroid

Yes, I have 40 columns in my data set, for each column then I would end up adding one multi-row formula tool. I am actually looking for a solution with which I can use one tool or a macro to update all the 40 columns at a go.

ShankerV
17 - Castor

Hi @aroy061987 

 

Step 1: Input the data

ShankerV_0-1686905170264.png

 

Step 2: To remove the blanks in the input file, if you do not have in your input, you can ignore the step 2. 

This might be due to copy paste issue also.

 

ShankerV_1-1686905238571.png

 

ShankerV_2-1686905278211.png

 

 

Step 3:

 

ShankerV_3-1686905291281.png

IF IsEmpty([Field 1])
THEN [Row-1:Field 1]
ELSE [Field 1]
ENDIF

 

ShankerV_4-1686905299732.png

 

Repeat for field 2 and 3 also.

 

ShankerV_5-1686905394562.png

ShankerV_6-1686905407321.png

 

 

Many thanks

Shanker V

FrederikE
13 - Pulsar

Hey @aroy061987,

 

A dynamic way to do this is by Transposing it before the multirow. 

FrederikE_0-1686905412832.png

 

 

2 Small Notes: 

Cross Tab changes the order of the columns and changes " " to "_" this you might need to correct manually again if it occurs. 

ShankerV
17 - Castor

Hi @aroy061987 

 

sorry my bad, didnt notice the last line mentioned for 40 columns.

I see my fellow friend @FrederikE has proposed a solution, check whether that works for you.

 

Many thanks

Shanker V

aroy061987
6 - Meteoroid

Thanks, But I am looking for something less time consuming as I have 40 such columns to update. As per my requirement I even can not remove the blank rows.

 

I need some hacks to update all these 40 rows at a go without adding 40 multi-row formula tools.

PhilipMannering
16 - Nebula
16 - Nebula

You can try transposing all your columns and then use one MultiRow Tool as per @FrederikE 's solution above.

aroy061987
6 - Meteoroid

Yes this worked perfectly for me!

 

Thanks a lot for this brilliant and simple solution.

PhilipMannering
16 - Nebula
16 - Nebula

Here's a Python Tool solution (just for kicks),

 

from ayx import Alteryx
import pandas as pd
df = Alteryx.read('#1')


#################################
df = df.replace(regex='^\s*$', value=pd.NA).ffill()


#################################
Alteryx.write(df, 3)
Labels