SQLServerCentral Article

Day 3 of The OLAP Sprint

,

Day 3: 11:29pm: BI Immersion

Great day today.

Brian and Devin Knight’s full-day precon session was filled with lots of great BI info and demos. They’re both entertaining, so it’s not difficult to stay engaged for the whole day, though the information download is a bit like drinking from a fire hose. The big takeaways for me were the explanations and discussions on cube dimensions, including dimension hierarchies and attribute relationships. The explanation of how compound key columns in dimension attributes are necessary in hierarchies (to resolve cryptic Visual Studio error messages) relieved a lot of pain for me. The other main takeaway for me was the importance of a solid data warehouse in the MOLAP model (it doesn’t seem to exist in the Tabular model). Brian made the statement that 70% of a BI project takes place in SSIS, tending to the data warehouse, which surprised me.

So, I spent some time cleaning up my pseudo-data warehouse, which is really just a handful of views that I’ve built in my OLTP system. This would be an untenable model in any environment other than on a laptop in a hotel room. I modified my views to include a few more joins, so that I could create more comprehensive dimensions, and removed columns that I knew I wasn’t going to be using. So, my cube is now looking not so hacky:

Monday’s Cube

I also spent some time in SSMS playing with MDX, and came away feeling that MDX is not for dilettantes. I managed to put together a few queries, which I’ll include at the end of this post, but this was very much me playing the role of Don Quixote, galloping on my mule, with a bucket on my head, tilting at windmills.

What?! No code completion for MDX?

I finished the day on a good note. I downloaded Report Builder 3, and an ESRI shapefile from Statistics Canada, and put together a report which visualizes gross sales by province nicely. In the same way that it was nice to see my data come to life in my first experience with the cube browser late on Saturday night, it was great to see my data reflected in a visualization tonight.

As far as data visualizations go, it’s just the tip of the iceberg, but I wanted to get it under my belt. With any luck, I’ll be able to move forward to the more interactive and dynamic tools.

On another note, the food at PASS was outstanding. A well-rounded plate (two, actually) of salad, potatoes, veggies, and salmon was a nice compliment to the rest of my not-so-balanced diet of chicken burritos and Heineken.

Okay – here’s the MDX:

MDX Query #1

A query to retrieve the Total Price measure (gross sales) with tuples specified on 3 different dimensions:

- DimRetailer (City)

- DimProduct (Confection Type Major)

- DimDate (Year)

In plain English, the measure being retrieved means something like: the gross sales of chocolate sold in Summerside (PEI), in 2012
SELECT Measures.[Total Price] ON COLUMNS

FROM [OLAP Sprint DW]

WHERE

(

[DimRetailer].[Geography].[CAN].[Atlantic].[PE].[Summerside],

[DimProduct].[Confection Type Major Desc].[Chocolate],

[DimDate].[Year Name].[Calendar 2012]

);

MDX Query #2

- Added a gropuing attribute from the DimRetailer dimension (Province) to the SELECT clause

- Used a range for the Calendar Year attribute in the FROM clause.
SELECT

Measures.[Total Price] ON COLUMNS,

[DimRetailer].[Retailer State Prov Abr].ALLMEMBERS ON ROWS

FROM [OLAP Sprint DW]

WHERE

(

[DimRetailer].[Retailer Country Abr].[CAN],

[DimProduct].[Confection Type Major Desc].[Chocolate],

[DimDate].[Year Name].[Calendar 2011]:[DimDate].[Year Name].[Calendar 2012]

);

MDX Query #3

- Used the TopCount function in the SELECT clause to achieve the following:

Return top 5 Sales Reps (no house accounts) in 2012, measured by the Total Price measure.
SELECT

{[Measures].[DCount of Retailers], [Measures].[Total Price] } ON COLUMNS,

TopCount( [DimSalesRep].[Sales Rep Full Name].MEMBERS, 6, [Measures].[Total Price]) ON ROWS

FROM [OLAP Sprint DW]

WHERE

(

[DimSalesRep].[Sales Rep Is House Account].[False],

[DimDate].[Year Name].[Calendar 2012]

)

Reprinted with permission from http://OLAPsprint.com/

The Other Days

Follow along on this journey and read the other days of Simon's pointed learning journey.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating