Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Column A formula, Where column B exists use Column B, When Column B is Null Use A

wonka1234
10 - Fireball

Hi all

 

I am trying to do the following logic:

 

Column A formula: Where column B exists use Column B, When Column B is Null Use A

 

Column B should only have 50 records, so I want to overwrite column A values when this exists. 

Column A should have 10,000 records, so I want to keep majority of these when B is null.

 

Thanks

5 REPLIES 5
binu_acs
21 - Polaris

@wonka1234 you can write something like below

 

IIF ( !IsNull([Column B]),[Column B],[Column A])

MarqueeCrew
20 - Arcturus
20 - Arcturus

@SeanAdams ,

 

How would you solve this challenge?

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Qiu
21 - Polaris
21 - Polaris

@MarqueeCrew 
I think if we apply the approach from @binu_acs , it should work.
Do you see other challenges?

MarqueeCrew
20 - Arcturus
20 - Arcturus

@Qiu ,

 

The initial ask from @wonka1234 includes:

 

I am trying to do the following logic:

 


@wonka1234 wrote:

Hi all

 

I am trying to do the following logic:

 

Column A formula: Where column B exists use Column B, When Column B is Null Use A

 

Column B should only have 50 records, so I want to overwrite column A values when this exists. 

Column A should have 10,000 records, so I want to keep majority of these when B is null.

 

Thanks


This isn't clear to me.  While I assume that one column has 50 "VALUES" (instead of records), the entire intent is not clear.  The SUBJECT of the post is answered by the expression.

 

The content of the response doesn't serve to teach or clarify.  I think that the response should help the initial user to overcome their challenge and help future readers.  The presence of a formula in this case appears to be a minimal effort.  I've answered posts with "here's a quick formula"  but this seems just too terse.

 

The use of the IIF() function without any explanation might be confusing and simply answer the question without explaining why it works.  We don't know where the initial question challenge rests.  The expression is specific to NULL() values.  IsNULL() might be right, but do we explain why to use IsEmpty() in case the user is saying NULL but the data is actually empty?

 

The alternative formula that I like is:

Max([Column A],[Column B])

 

This can only be used when A and B don't exist at the same time.

 

In summary, we're not sure if we are answering the right question or if the question reflects an interest in learning.  @SeanAdams had mentioned to me that he had a discussion with @binu_acs about more complete answer posts.  The original poster hasn't yet marked this as a solve or provided any feedback on the solution.  Maybe they figured it out for themselves.  I like that thought.  It has happened for me that by the time that I simplify and explain my predicament in a post that the answer shortly comes to me.  Clearly explaining the challenge is often enough for me to see my way to the solution.

 

Cheers,


Mark

 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Qiu
21 - Polaris
21 - Polaris

@MarqueeCrew 
Thank you so much for taking up time to explain your thoughts to me and now I see what is yor concern.
Most of times, the question is not really clear, I have to say. 😁

Labels
Top Solution Authors