Select rows with unique values, parsed by the specified key field(s). All rows which do not include unique values in at least one selected "Key" column, will be discarded.
Example 1
In this example, the Unique function is set to parse only the columns "dim_A" and "dim_B".


Example Input 1
dim_A | dim_B | metric_1 |
AAA | DDD | 111 |
AAA | DDD | 111 |
AAA | DDD | 222 |
BBB | EEE | 333 |
BBB | FFF | 444 |
CCC | GGG | 555 |
CCC | GGG | 666 |
CCC | HHH | 777 |
Example Output 1
dim_A | dim_B | metric_1 |
BBB | EEE | 333 |
BBB | FFF | 444 |
CCC | HHH | 777 |
Example 2
In this example, we set no "Key" variable, and Unique will run for all columns.

Example Input 2
dim_A | dim_B | metric_1 |
AAA | DDD | 111 |
AAA | DDD | 111 |
AAA | DDD | 222 |
BBB | EEE | 333 |
BBB | FFF | 444 |
CCC | GGG | 555 |
CCC | GGG | 666 |
CCC | HHH | 777 |
Example Output 2
dim_A | dim_B | metric_1 |
AAA | DDD | 222 |
BBB | EEE | 333 |
BBB | FFF | 444 |
CCC | GGG | 555 |
CCC | GGG | 666 |
CCC | HHH | 777 |
I Ain't Afraid of No Code!
Example 1-
[ [ "unique", { "subtable": null, "presorted": false, "key": [ "dim_A", "dim_B" ], "_comment": null } ] ]
[
[
"unique",
{
"subtable": null,
"presorted": false,
"key": null,
"_comment": null
}
]
]
param str subtable: Name a subtable in which output will be stored (will create subtable where necessary).
param boolean presorted: Default is false.
param list key: The (optional) field key(s).
param str comment: A comment that will appear in the Transformation UI.
Comments
0 comments
Article is closed for comments.