IsTestCase (DMX)

APPLIES TO:yesSQL Server Analysis ServicesnoAzure Analysis Services

Indicates whether a case is used as a test case for the specified data mining model or mining structure.



Result Type

Returns true if the case is a part of the test data set; otherwise false.


If you use the Data Mining Wizard to create a mining structure and related mining model, by default, 30 percent of the cases are set aside for use as a test data set. The remaining cases are used for training the data mining model. The same test data set can be used with all models that are based on that structure. However, if you use DMX to create the mining model, by default, all data is used to train the model, and no test set is created. To enable creation of a test data set, you must set the parameters of the WITH HOLDOUT clause.

You can determine whether a test set has been created on a particular mining structure by viewing the value of the HoldoutMaxCases and HoldoutMaxPercent properties.


Drillthrough must be enabled on the model if you want to use the IsTrainingCase or IsTestCase functions to return details about the cases in a particular model. For more information, see Enable Drillthrough for a Mining Model.

To return cases that are part of the training data set, use the function IsTrainingCase (DMX).


The following example uses the Targeted Mailing mining structure that is created in the Basic Data Mining Tutorial. The query returns all the cases in the structure that are used for testing.

FROM [Targeted Mailing].CASES  
WHERE IsTestCase()  

For more information about how to query cases used in data mining, see SELECT FROM <model>.CASES (DMX) and SELECT FROM <structure>.CASES.

See Also

Functions (DMX)
Data Mining Queries
Training and Testing Data Sets