I have the following data in alteryx.
Name | Category | % | Output |
A | XX | 25% | YY |
A | YY | 75% | YY |
B | XX | 40% | XX |
B | YY | 20% | XX |
B | ZZ | 15% | XX |
B | 25% | XX | |
C | ZZ | 20% | General |
C | XX | 40% | General |
C | YY | 40% | General |
D | YY | 100% | |
E | 50% | ||
E | ZZ | 50% |
I want the output to be the category column based on maximum value of % in a name. For example - For B, 40% is maximum, hence output is XX which corresponds to 40%
However, if the maximum % is same of two categories, I want it to be tagged as "General". For example: in C, the max % is 40% of XX and YY, hence tagging is "General"
Please help, thanks!
Solved! Go to Solution.
Hi @tanishmittal,
Attached is a workflow that meets your criteria. The workflow finds the maximum value by Name, then Joins to find the Categories that match that Name and Value. Then second Summarize tool groups again by Name and concatenates all matching Categories, separating values by a pipe. The Formula tool finds any concatenated values (pipe) and changes them to "General". Then the results are Joined back with the original data.
Thanks @T_Willins, this works brilliantly.
Side note for other using this solution: Concatenate also yields "," instead of "/" at times, so make sure you check the same in your database. Thanks!
Hi @tanishmittal,
You can select the concatenate separator in the Summarize tool. For simple concatenations I usually select the pipe instead of the comma as the pipe is not commonly used outside of as an OR command in codes.