Hi Everyone,
I am new to Alteryx and trying to put a if/else formula in Alteryx to get the desired column.
I want a formula where If my new column "Data source derived" is blank then put value of "column A" otherwise if again my new column "data source derived" is blank then put "column B" if again it is blank then put "column C".
I am attaching a workflow and input , In the Input "Data Source" column is having desired output for your reference.and also if you will run the attached workflow then you can see the value of "Derived Data Source" column , it is working for first if else only .
Any help is appreciated and Many Thanks in advance!!
Hi @YashikaVaish,
you can use a IF formula like the one below :
if [Error category] = 'BD' then 'Error'
elseif IsNull([Data Source Derived]) and !isnull([A]) then [A]
elseif IsNull([Data Source Derived]) and !isnull([B]) then [B]
elseif IsNull([Data Source Derived]) and !isnull([C]) then [C]
else [Data Source Derived] endif
It tests if the field A isnull and the new column is null, if not takes A, then tries with B then with C
The trick is to use elseif to make it easier to read!
Hope it helps!
I'm a little confused by your example - are you just trying to get the first value out of A, B, C (going left to right) that is not null?
If so, the attached should work. I essentially added a record ID to each, so I'd know where the records came from. I then removed the extra fields that wouldn't be taken into consideration for this match. I transposed the data to get all of the values in one column, and used a filter to remove the nulls. After that, I used a Summarize to grab the first value per record ID (which would be the first value filled in from the original table). I used a Join to bring these values back together with the original dataset.
This is dynamic and will handle any number of columns, rather than hardcoding to only account for three (A, B, C).
Hope this helps!
Hi , Thank you for the solution but This if else is also giving wrong output like the previous one . I tried this way of if else .
Hi Thank you for sharing the if else workflow , The output is actually correct but I want to add one more condition like if my error category column value is "BD" then put "error" in "Derived Data Source" column. and also I want to check serial wise like if my newly added column value is null then replace it with column A if still it is null then replace it with column B and so on like in "Data Source" column. Can you help me to rectify if condition for the same.
User | Count |
---|---|
19 | |
15 | |
15 | |
9 | |
8 |