Search code examples
t-sqlsql-server-2012ssasedmx

Microsoft MDX tutorial: source structure column not found


I am in the process of learning about Microsoft's Analysis Services for SQL Server 2012. Having gone through the basic AdventureWorks tutorial using the VisualStudio 2012 plugins, I am now trying my hand at executing these same procedures using the DMX Query language.

The tutorial I am refering to can be found here:

http://msdn.microsoft.com/en-us/library/4b634cc1-86dc-42ec-9804-a19292fe8448(v=sql.110)

The Database project I am using in the Analysis Server is that of the BasicDataMining project as can be found upon the completion of the BasicDataMining tutorial here:

http://msdn.microsoft.com/en-us/library/ms167167(v=sql.110).aspx

The first lesson in the DMX tutorial goes well having used the following query to create the Mining Structure:

CREATE MINING STRUCTURE [Bike Buyer]
(
   [Customer Key] LONG KEY,
   [Age]LONG DISCRETIZED(Automatic,10),
   [Bike Buyer] LONG DISCRETE,
   [Commute Distance] TEXT DISCRETE,
   [Education] TEXT DISCRETE,
   [Gender] TEXT DISCRETE,
   [House Owner Flag] TEXT DISCRETE,
   [Marital Status] TEXT DISCRETE,
   [Number Cars Owned]LONG DISCRETE,
   [Number Children At Home]LONG DISCRETE,
   [Occupation] TEXT DISCRETE,
   [Region] TEXT DISCRETE,
   [Total Children]LONG DISCRETE,
   [Yearly Income] DOUBLE CONTINUOUS
)
WITH HOLDOUT (30 PERCENT or 1000 CASES)

When I arrive at the second lesson however the suggested query does not work:

ALTER MINING STRUCTURE [Bike Buyer]
ADD MINING MODEL [Decision Tree]
(
   CustomerKey,
   [Age],
   [Bike Buyer] PREDICT,
   [Commute Distance],
   [Education],
   [Gender],
   [House Owner Flag],
   [Marital Status],
   [Number Cars Owned],
   [Number Children At Home],
   [Occupation],
   [Region],
   [Total Children],
   [Yearly Income]
) USING Microsoft_Decision_Trees
WITH DRILLTHROUGH

Providing the following error:

Error (Data mining): The 'CustomerKey' source structure column for the 'CustomerKey'      mining model column was not found.

I am puzzled as how to solve this and why literal queries from Microsoft's own tutorial do not seem to work.

I would greatly appreciate any insights that can help me resolve this problem and proceed with this tutorial.


Solution

  • ALTER MINING STRUCTURE [Bike Buyer]
    ADD MINING MODEL [Decision Tree]
        (
           **[Customer Key]**,   <-- Missing space was the issue
           [Age],
           [Bike Buyer] PREDICT,
           [Commute Distance],
           [Education],
           [Gender],
           [House Owner Flag],
           [Marital Status],
           [Number Cars Owned],
           [Number Children At Home],
           [Occupation],
           [Region],
           [Total Children],
           [Yearly Income]
        ) USING Microsoft_Decision_Trees
        WITH DRILLTHROUGH