{{ transformations:GroupAction.png}}
====== GROUP ======
Category: Transform / Advanced\\
\\
=====Description=====
Replace multiple values with a single value (constant or calculated). \\
\\
=====Use cases=====
* Creating flags that can later be used in expressions. In this case the flag will designate a group (set), therefore verifying if a value belongs to the group can be done by checking the flag. For instance, instead of expressions with multiple comparisons, e.g. if([x]='A' or [x]='B' or [x]='C' ...)
it can be more convenient to flag A, B, C,.. with 'Yes' using the //Group// action, and then rewrite expressions using the flag: if([Flag]='Yes', ...)
* Group values for charts (e.g. changing insignificant dimension values to "Other")
* Calculating new values of a column only for particular values in another column, leaving the rest unchanged.
* Create secondary demographic sets, combining specified values into rollup groups.
\\
=====Action settings=====
^Setting^Description^
|Create/Replace column|Select whether the results will replace the values in an existing column or be created in a new column.\\ Options: //Create new column// (and provide a column name), or //Replace existing// (and select an existing column).|
|Group (flag) as*|Provide a static value or expression that will be used as the flag value. All selected values will be converted\\ to this value. Options: //It's an expression// or //It's a text or number//. |
|Lookup column|Select the column with the values to be grouped. Once chosen, a list of values present in the column will be\\ displayed at the bottom of the action settings pane. |
|Grouping|Choose whether the selected values will be replaced with the group (flag) value, or whether all values //except//\\ the selected values will be replaced. Options: //Group selected//, or //Group all but selected//.|
|Value selection|Select the values to be replaced, or excluded from replacement, in the list.|
* Setting can be specified using a [[:parameters|parameter]].
\\
=====Remarks=====
Values that are not converted to the group (flag) value retain their original value.
This action replaces whole, selected values within the //Lookup column//, and does not work on partial matches.\\
\\
=====Examples=====
(coming soon)
\\
=====See also=====
* [[syntax:functions|Functions: In()]]
* [[syntax:functions|Functions: Match()]]