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

Alteryx Designer Desktop Discussions

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

Dynamic remove column based on total row

joshuaslater61
5 - Atom

Hi there,

 

Amateur Alteryx user... I want to dynamically remove columns based on a 0 total row. See image below. I have read that the dynamic select tools is best, but I cannot figure out the best way to do this. Anyone know how?  

 

6 REPLIES 6
DavidP
17 - Castor
17 - Castor

If your zero columns always have zeros in all rows, you'll probably get away with something like this.

 

Another option might be to use a dynamic rename first and build some sort of logic to insert the word zero into the column names where total is zero, then you can use a formula in the dynamic select tool like 

 

!contains([Name],'zero')

 

DavidP_0-1583570741078.png

 

ramesh_neel
11 - Bolide
11 - Bolide

@DavidP  - Size function does not seem to work when the values under the fields are positive numbers .I tried with a different data set with an additional column with just positive numbers under it. 

 

@joshuaslater61  - https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Dynamic-Select/td-p/523145 , have you seen this post and the solutions posted ? It's pretty much similar to what you are asking for, just need to tweak it a bit to pick the last 1 row instead of the first row and check if its zero. 

Alteryx ACE | Sydney Alteryx User Group Lead | SparkED Contributor and Mentor
danilang
19 - Altair
19 - Altair

Hi @joshuaslater61 

 

Here's the tweek that @ramesh_neel mentioned

 

w.png

The "check if zero" formula is a little complex

 

 

if !Regex_match([Value],"[a-z]+",1) and !isnull([Value]) and tonumber([Value])=0 then
	"Zero"
else
	[name]
endif

 

 

It renames if the value doesn't contains any characters, the value isn't null and value itself is 0.  The extra conditions are there to catch things like extra columns that don't have numeric data and columns that don't have a value in the total row.

 

r.png  

Dan

joshuaslater61
5 - Atom

@danilang This was fantastic and simple! Thank you so much. YOu taught me more about the dynamic rename tool as well, I appreciate it.

danilang
19 - Altair
19 - Altair

My pleasure @joshuaslater61 

 

But the name lang...danilang.  Castor is my rank in the community 

 

Dan

w_chivers
7 - Meteor

Yes, brilliant, and simple to implement. Thank you!

Labels
Top Solution Authors