community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Dynamic Formula

Meteor

Hi Folks in Alteryx Community,

 

I was trying to apply multiple conditions to a data set to filter data. I stored my conditions in another Excel sheet. I want Alteryx to loop through that condition file, change formula based on the values in that file and then filter my data.

Capture.PNG

 

 

Here is my data, it has client ID, carrier ID and dollar amount of orders. But the condition is really complicated as shown in the picture below

Capture.PNG

 

 

The third column indicates if I want to look up the multiple of Column Increment. The fourth column indicates if I want to look up value that is less than increment.

For example, if carrier is A and MultipleOrNot = 1 and LessThanIncrement is 0. In my data, I want all carrier A records that with a dollar amount of 0.05/-0.05 or multiples of 0.05/0.05.

 

Or, if carrier is A and MultipleOrNot = 1 and LessThanIncremrnt is 1. In my data, I want all carrier A records that with a dollar amount of 0.05/-0.05 or multiples of 0.05/0.05 or is between -0.05 and 0.05. Then move to the next condition.

 

So basically the formula will change based on the value in MultipleOrNot and LessThanIncrement. Something like 

 

if MultipleOrNot = 1 AND LessThanIncrement =1, formula is if MOD(value, increment) =0 or value is between -increment and increment.

 

Then it will go to my data, say, if carrier = A, increment = 0.05. Then filter my data.

 

I know it's complicated. Any suggestions will be appreciated I attached the two files for my test.

Alteryx Certified Partner
Alteryx Certified Partner

@CodingMan,

 

I'm hesitant to agree with you concerning the dynamic formula solution path.  It looks to me like you have the opportunity to JOIN the client row data with the client rule data.  This would cause you to get a record with both data + rules together.  Then you can standardize your formula (without respect to Client/Carrier) and use IF/THEN/ELSE to setup the formula calculation.

 

If you prefer, you can even FILTER the rows that have similar formulas (e.g. MultipleOrNot = 1) and use a formula tool that is specific to the context of the data for each stream of records.  A workflow constructed for readability and ease of maintenance is preferable to one that requires advanced techniques.  Note also, that you need to handle exceptions for client/carrier combinations where rules don't exist.

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.

I agree with @MarqueeCrew

 

2018-10-22_15-20-25.png

 

I think I join on Carrier and Client will get you started then you can just use the filter tool. The expression will be a little nested but should be possible. 

Labels