The Alteryx Community is a finalist in three 2026 CMX Awards! Help us win Customer Support Community, Most Engaged Community, and User Group Program of the Year - vote now! (it only takes about 2 minutes) before January 9.
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

How to repeat a value in a column based on the value from another column

jdbustamantec
Météoroïde

I have the following table

 

NameCode
A 
A1
B 
B2
C 
C3

 

some rows have nulls in the code column and I want to repeat the same value as the row below if the value in the name column is the same. Below the results I'm expecting:

 

NameCode

A

1
A1
B2
B2
C3
C3

 

Any ideas on how to do this? Thanks

4 RÉPONSES 4
FrederikE
Pulsar

Hey @jdbustamantec,

 

Multi-Row does the trick:

 

IF IsNull([Code])
THEN [Row+1:Code]
ELSE [Code]
ENDIF

 

Make sure to tick "Group By" Name to achive this: " if the value in the name column is the same."

 

See the attached example.

salvador_ian
Météore

Hello @FrederikE

I have the same question as @jdbustamantec .

But on my data, I think I would have to use both Row-1 and Row+1. Is there a way to do this using 1 tool? 

NameCode
A 
A

1

A

 

B 
B2
B 
C 
C3
C 

or is there any smarter way to do this if I have multiple columns that needs similar method?

NameCodeCode2Code3
A X 
A

1

 

 

A

 

 

Y

B  Y
B2X 
B   
C  Y
C3  
C X 

Thank you in advance!

 

use summarize and concate the value? remove the delimiter of course. 
but this only apply it only have 1 value each.

salvador_ian
Météore

ohh your right! thank you for the idea!
I can just use the Join tool to add the concatenated columns again. 
Tested it and works, Thank you!

Étiquettes
Auteurs des meilleures solutions