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

Alteryx Designer Desktop Discussions

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

How can I generate rows based on a logical test

juliussorensen
6 - Meteoroid

Suppose I have the following table:

 

CustomerProductProfitFlag
A1100True
A2150True
B1100False

 

 

If the flag is True for a customer it is True for all instances of that Customer. Likewise if it is false.

 

And I would like to do a logical test something like:

If Customer grouped by flag = True

Generate 1 row for Customer with product 3 where profit 200

else

do nothing to the customer

endif

 

So I would get the following output from the example above:

 

CustomerProductProfitFlag
A1100True
A2150True
A3200True
B1100False

 

How would I go by creating this?

 

Sorry for the terrible pseudocode. Thanks in advance!

 

 

 

3 REPLIES 3
Luke_C
17 - Castor
17 - Castor

Hi @juliussorensen 

 

Here's an example of one option that does what you describe, though I suspect your logic might end up being a bit more complicated.

 

  1. Group by customer, concatenate flags
  2. filter out records with false in the flags
  3. Update fields as mentioned (product 3, profit 300)
  4. Union back to data

 

Luke_C_0-1675433757745.png

 

 

juliussorensen
6 - Meteoroid

Hi @Luke_C 

 

Thank you for your swift reply! I can use this solve my task.

Emmanuel_G
13 - Pulsar

@juliussorensen 

 

Find in attachement the way of doing that.

 

Let us know if it works as you want.

 

Emmanuel_G_0-1675434598302.png

 

Labels