We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Data transformation

RajatRehria
8 - Asteroid

Hi Guys,

 

I have a logic in a table below, I want to incorporate this logic in my main data set.

 

For example Combination 1 states if in my main dataset "Cost" column value = 109353 and "Profit" column value = 143085 then filter my main data as Required. Similarly each combination  conditions i need to incorporate in my main data set and lastly categorised them as Group 1 etc.

 

GroupsCombinationColumn namesSignDescriptionValue
Group 11Cost=is equal109353
Group 11Profit=is equal143085
Group 12Profit>=is greater or equal114558
Group 12Profit<=is smaller or equal164925
Group 12Cost>=is greater or equal180052
Group 12Cost<=is smaller or equal133952
Group 13Profit=is equal176437
Group 13Cost=is equal166891
Group 14Profit=is equal144627
Group 14Cost=is equal198735
Group 15Cost=is equal166080
Group 15Profit=is equal130630
Group 16Cost=is equal129679
Group 21Cost=is equal197602
Group 21Level0<=is smaller or equal172640
Group 22Cost=is equal105669
Group 23Level0>is greater162398
Group 23Cost=is equal106784

 

Example: below is a snippet of my Raw input of main dataset

CostProfitLevel0
109353143085190734
102226148795189911

 

Required output after incorporating the above logic in the main data set:

CostProfitLevel0ChecksGroups
109353143085190734Required  Group 1
102226148795189911Not required 

 

Kindly help in suggesting a way using which i can incorporate the logic into my main data set. Thanks. 

4 REPLIES 4
cjaneczko
13 - Pulsar

You should be able to create this logic in a Formula Tool. See the code below. Then add another formula that checks if the word Group appears in the Groups field. If it does then have it say Required, if not, then its Not Required. 

 

 

if [Cost] = 109353 and [Profit] = 143085 then 'Group 1' 
elseif [Profit] >= 114558 and [Profit] <= 164925 and [Cost]>= 180052 and [Cost] <= 133952 then 'Group 1' 
elseif [Profit] = 176437 and [Cost] = 166891 then 'Group 1' 
elseif [Profit] = 144627 and [Cost] = 198735 then 'Group 1' 
elseif [Cost] = 166080 and [Profit] = 130630 then 'Group 1' 
elseif [Cost] = 129679 then 'Group 1' 
elseif [Cost] = 197602 and [Level0] <= 172640 then 'Group 2' 
elseif [Cost] = 105669 then 'Group 2' 
elseif [Level0] > 162398 and [Cost] = 106784 then 'Group 2' 
else '' 
endif

 

 

if IsEmpty([Group]) then 'Not Required' else 'Required' endif

 

image.pngimage.png

RajatRehria
8 - Asteroid

Hi @cjaneczko thanks for a solution, however I am looking for a solution which can use the Logic Table as Text Input rather that creating a static formula. I am looking for a solution which can use the table as logic. Thanks.

caltang
17 - Castor
17 - Castor

It's hard to break the value of a record into its own operator. You can do it with "=", but ">" or "<" symbols will be difficult in this case. 

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
cjaneczko
13 - Pulsar

I do not think it is possible to do what you are looking to do. You would have to append every condition to every row and check each condition one by one using a Boolean indicator. Then likely use a multi row formula to see where all rows for a condition = 1.

Labels
Top Solution Authors