Open up your SSMS (Sequel Server Management Studio) and make a connection to your “Adventure Works” OLAP database.
Click on the MDX query button: .
This will gets us our workbench:
From the cube drop down we can select the cube we want to work with:
for the time being we will leave it at Adventure Works.
In the query page enter:
SELECT
[Measures].[Sales Amount] ON COLUMNS
FROM
[Adventure Works]
This will get us:
Although it’s a nice sum it doesn’t really mean anything…. Let’s add the year 2010:
SELECT
[Measures].[Sales Amount] ON COLUMNS
,
[Date].[Calendar Year].&[2010] ON ROWS
FROM
[Adventure Works]
This will get us:
Ok, that is one year, lets add several:
SELECT
[Measures].[Sales Amount] ON COLUMNS
,
{
[Date].[Calendar Year].&[2010]
, [Date].[Calendar Year].&[2011]
, [Date].[Calendar Year].&[2013]
, [Date].[Calendar Year].&[2014]
}
ON ROWS
FROM
[Adventure Works]
This will get us:
Ok, but I don’t want to type out everything every time…. How about:
SELECT
[Measures].[Sales Amount] ON COLUMNS
,
{
[Date].[Calendar Year].Children
}
ON ROWS
FROM
[Adventure Works]
This will get us:
But I don’t want to see the years where there is no Sales Amount. So let’s filter out the years which are not empty (NULL):
SELECT
[Measures].[Sales Amount] ON COLUMNS
,NON EMPTY
[Date].[Calendar Year].CHILDREN ON ROWS
FROM
[Adventure Works]
This will get us:
Have Fun And Till Next Time
No comments:
Post a Comment