Using Microsoft SSAS
and SQLServer 2012
I am currently trying to update my timeseries
model by using new values from my original source database table.
The Microsoft tutorials present for DMX
suggesting using EXTEND_MODEL_CASES
to update the model using PREDICTION JOIN
and static values, for the sake of automation my aim is to do this using a SELECT FROM
but am unsure how to refer back to my original data source.
EDIT : CLARIFICATION: the below code does not work as SSAS cannot seem to access my database table this way The question therefor is: How can I select a database table from within SSAS
SELECT [DumpLocation_Id],
PredictTimeSeries([TotalDumpCount],5, EXTEND_MODEL_CASES) AS PredictDmpCnt
FROM
[DumpForecasting_MIXED]
NATURAL PREDICTION JOIN
( select * from DumpStatistics3
where TimeIndex >= (getdate() - 2))
AS t
My expectation is to get a result set from said table inserted into my model.
Say my model contains:
DumpLocation_id | TimeIndex | TotalDumpCount |
--------------------------------------------------------
1 |01-01-2014 | 23
1 |02-01-2014 | 13
1 |03-01-2014 | 14
I want to be able to select the data from my Database Table:
DumpLocation_id | TimeIndex | TotalDumpCount |
--------------------------------------------------------
1 |01-01-2014 | 23
1 |02-01-2014 | 13
1 |03-01-2014 | 14
1 |04-01-2014 | 15
1 |05-01-2014 | 17
and add it to my model so that the newer entries get entered into my model.
I wanted to place what I came up with on here in case someone else runs into the same problem:
In order to select Tables from a relationalDatabase DMX
supports the OPENQUERY
statement (this has also been implemented in tsql
)
OPENQUERY
takes a string as argument that holds an equivalent of a tsql
query.
example:
OPENQUERY (relDatabaseServer, 'SELECT name FROM example.titles WHERE name = ''NewTitle''');