Quantcast
Channel: Data Preparation & Blending discussions
Viewing all articles
Browse latest Browse all 4999

Assigning values based on multiple field condition

$
0
0

Hi, I have been using the multi-field formula, summarize, and tile tool in various combinations to try to get the results I need, and I just can't seem to get there!

 

My dataset looks something like these first 3 fields and I would like to add the fourth field, where, if the customer has been to ONLY company X then assign a 0 to each instance of customer (at the different sites). If the customer has been to ONLY company Y then assign a 1 to each instance of customer and if the customer has been to BOTH company X and Y then assign a 2 to each instance of customer. 

CustomerSiteCompanyNew Field
A1X0
A2X0
A3X0
A4X0
B4Y1
C5X0
C6X0
C4X0
D2X2
D5X2
D6X2
D4X2
D7Y2
D8Y2

 

 

I used the tile tool (company as unique field and grouping by customer) to get a tile number. Then used the formula IF [Tile_Num] = 1 AND [Company] = "X" THEN 0 ELSEIF [Tile_Num] = 2 AND [Company] = "Y" THEN 1 ELSE 2 ENDIF

 

Unfortunately, this only applies a 2 to the instances of customer where Company is Y and not X.

 

I may be overcomplicating this, any suggestions?

 

Thanks in advance!


Viewing all articles
Browse latest Browse all 4999

Trending Articles