Distributing rows equally with query activities

Devs United > SFMC Pros  > Distributing rows equally with query activities

Distributing rows equally with query activities

The new Create Random Data Extension Feature

Creating random audiences based on a master Data Extension can be done thanks to a new feature in ET that allows you to create a random Data Extension.

However there are times where you will be forced to use a Query Activity to distribute your audience into different and equally random groups (for example, combining your audience with a Data View).

You might be able to accomplish this task using a SELECT TOP PERCENT clause, but there is an easier approach using the NTILE clause in a Query Activity.  This powerful clause allows you to  split a table into groups and assign a number to that group.

This way, you can create one Query that assigns a group number to each row and then leverage a Data Filter to move the Data into the different segmented Data Extensions.

Another benefit to this approach is that you will be leveraging the power of Data Filters that do not require SQL knowledge to configure.

The following example demostrates how to use the NTILE clause to divide a Data Extension called Subscribers into 3 parts:

[gist id=”895d0b95b8c60073806c4a2d0174feff” ]