Alteryx Designer Desktop Discussions

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

Create Formula (if caluse) using values from different source

sbatra116
8 - Asteroid

 

Create IF condition using the below 2 columns (column 1 and column 3). 

condition: (Age_Business_Days > 0)

 

sbatra116_0-1653953596426.png

 

then use this condition to filter data.

 

thank you

10 REPLIES 10
ddiesel
13 - Pulsar
13 - Pulsar

Hi @sbatra116!

 

Will you please provide more details or a sample of your data?

 

A formula like this might work in the Filter tool, depending on the structure of your data:

[AgeCondition] > 0

 

Capture.JPG

 

DataNath
17 - Castor

Can't really tell too much about the requirement because of the lack of detail in your post. However, if this condition has a need to change dynamically then you may want to explore the dynamic replace tool. I've attached a small sample workflow and you would simply add a filter afterwards to remove nulls:

 

DataNath_0-1653955488581.png

 

sbatra116
8 - Asteroid

My bad. I should have written more detail.  @DataNath   @ddiesel

 

Update ---

 

Spreadsheet data 

IDNameAge_Business_Days
1Test110
2Test20
3Test33

 

 

Now the condition are stored in a different source (can be spreadsheet or db table)

 

column1column2column3
Age_Business_Daystestdata>0

 

In order to filter the spreadsheet data ; i'll be creating condition run time using column 1 and column 3 from the second table.

condition: (Age_Business_Days > 0)

 

if the second source gets updated, my condition should automatically update in the workflow depending upon the columns mentioned in second table.

 

binuacs
20 - Arcturus

@sbatra116 One way of doing this with the help of dynamic replace tool

 

binuacs_0-1653977407367.png

 

ddiesel
13 - Pulsar
13 - Pulsar

Hi @sbatra116!

 

Let's give this a try...

 

Capture.JPG

Is the operator in the condition always "greater than"? If there are other operators such as "less than" or "equal", we will need to add a bit more logic. 

 

Please let us know if this works.


Thanks,
Deb

 

 

ddiesel
13 - Pulsar
13 - Pulsar

@sbatra116 

P.S. Just saw @binuacs solution... very slick! I did not think to use the Dynamic Replace tool. 

 

sbatra116
8 - Asteroid

I like the approach here but how to handle once the condition changes (it can be either equal, greater or less than)

@ddiesel

sbatra116
8 - Asteroid

Hi  binuacs

 

Like the way you used the dynamic replace tool. But i'm not getting the result i want. 

 

Spreadsheet data 

IDNameAge_Business_Days
1Test110
2Test20
3Test33

 

condition

 

column1column3
Age_Business_Days>0

 

 

result should be 

 

IDNameAge_Business_Days
1Test110
3Test33
ddiesel
13 - Pulsar
13 - Pulsar

Hi again @sbatra116!

 

I still think @binuacs solution is more efficient, but here is how I would modify the logic in the workflow I provided.

 

Instead of cleansing the operator from the condition, both operator and value are joined to your data. A nested conditional statement in the filter tool is setup to handle the three different expected operators: > = <

Capture.JPG

Labels