sfmc // SQLPRODUCTION

Random Audience Split with NTILE()

Randomly divide an eligible audience into similarly sized groups.

sqlntilenewidab testholdout
Context Pack →Open Workspace →
Trust & provenancePRODUCTION
Evidence tierPRODUCTIONOfficial sources0Other sources0Last verifiedNot recorded

Evidence tier describes my hands-on relationship with the content. Official sources describe platform contracts/documentation. Production observations should not automatically be treated as official limits.

SELECT
    SubscriberKey,
    CASE SplitGroup
        WHEN 1 THEN 'A'
        WHEN 2 THEN 'B'
        ELSE 'HOLDOUT'
    END AS Variant
FROM (
    SELECT
        SubscriberKey,
        NTILE(3) OVER (ORDER BY NEWID()) AS SplitGroup
    FROM [Eligible_Audience]
) x
Operational notes

NEWID() randomizes ordering; NTILE() distributes rows across the requested number of buckets.

For stable experimental cohorts, persist the result rather than recalculating every run.