Alteryx Designer Desktop Discussions

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

How access the name of the column when writing formulas

yiying
5 - Atom

Hi there. I have a table like this. It has columns in names of months that serve as a sparse matrix. What I plan to do is for each row, I need to find the column with its name equals the value of [FCST_Month] and see if it's value is null. For example, for row #1 I want to check column [May] and see if the value is null or not. Does anyone know how to do that? I don't know how to access the column name. Thanks in advance!

 

#FCST_MonthMayJuneJulyAugust
1MayNull200Null100
2JuneNull200Null100
3JulyNullNullNullNull
4AugustNullNullNullNull

 

Thanks,

Yiying

3 REPLIES 3
Thableaus
17 - Castor
17 - Castor

Hey @yiying 

 

Here's how I would approach this question:

 

SolutionFieldNames.PNG

 

- Tranpose your Month Fields grouping by # and FCST_Month

- Create the Field "Null or Not" with the special condition:

If [FCST_Month] = [Name] and [Value] != "Null"
THEN "Not Null"
ELSEIF [FCST_Month] = [Name] and [Value] = "Null"
THEN "Null"
ELSE "" ENDIF

- Filter the non-empty Records

- Join the result back to the original not-transposed dataset

 

WF attached.

 

Cheers,

 

Thableaus
17 - Castor
17 - Castor

@yiying 

 

Another thing to add:

I actually set the condition to be = "Null" because the Null values are stored as strings.

If they are actually Null values, you should use the IsNull() function.

 

Cheers,

yiying
5 - Atom

Thanks for the help, that works perfectly!

 

Yiying

Labels