25
October 11-14, Seattle, WA Report Design for SSAS Cubes and MDX Paul Turley Mentor, SQL Server MVP

October 11-14, Seattle, WA Report Design for SSAS Cubes and MDX Paul Turley Mentor, SQL Server MVP

Embed Size (px)

Citation preview

October 11-14, Seattle, WA

Report Design for SSAS Cubes and MDX

Paul TurleyMentor, SQL Server MVP

Introduction

Paul TurleyMentor, SQL Server MVP

SqlServerBiBlog.com

2BID 302 | MDX Essentials for Report Design

What Can You Do with a Cube?

3

> Destroy anything in its path

> Aggregate very large volumes of data

> Assimilate entire civilizations

> Create a mega race of neo-humanoid androids with a single collective consciousness

> Present browse-able business information for self-service reporting

> Encapsulate complex business rules into predefined hierarchies, calculations, business measures and KPIs

> Create high-value business reports that render in a fraction of the time of a relational data source

BID 302 | MDX Essentials for Report Design

The Business Data Continuum

4

Operational Databases

Data Consolidation

& Transformation(ETL)

Relational Data Warehouse

OLAP Cubes

Reports, Charts, Dashboards & Scorecards

BID 302 | MDX Essentials for Report Design

Dimensional Data Warehouse Design

5

Date Dimension

EmployeeDimension

GeographyDimension

Customer Dimension

ProductDimension

VendorDimension

Sales Fact

BID 302 | MDX Essentials for Report Design

Contrasting Data Source Performance

Using a transactional data source

6

20 minutes to run…

500,000 records…

BID 302 | MDX Essentials for Report Design

Contrasting Data Source Performance

Using an OLAP cube

7

2 seconds to run query…

100,000,000 source records…

BID 302 | MDX Essentials for Report Design

Cube Design Process

Create Data

Source View

Design Dimension

s & Hierarchies

Create cube &

Dimensional Usage

Format Measur

es

8

Create Calculati

ons

Design Attribute Relations

hips

Design Partition

s

Design Aggregat

ions

BID 302 | MDX Essentials for Report Design

Dimensions

9

Dimension > Hierarchy > Level > Member

BID 302 | MDX Essentials for Report Design

Measures

Organized in measure groupsDerived from numeric fields or SQL calculationsCalculated members based on MDX scripted functionsKPIs based on MDX script for actual/goal, status & trend comparisons

10BID 302 | MDX Essentials for Report Design

Understanding Aggregate Functions

SSAS is optimized to manage pre-defined & strategically-derived aggregations• Logical Aggregations• Additive Measures• Semi-Additive Measures• Non-additive Measures• Aggregating Financial Accounts

11BID 302 | MDX Essentials for Report

Design

Basic Query Syntax

SELECT < member or set > on < Columns | Axis(0) | 0 >, < member or set > on < Rows | Axis(1) | 1 > FROM < cube or subcube expression > WHERE < member or set > ;

SELECT { [Sales Amount], [Order Quantity] } on Columns, [Category].Members on Rows FROM [Adventure Works] WHERE [CY 2001] ;

12BID 302 | MDX Essentials for Report

Design

Filtering

SlicerSELECT … on Columns, … on Rows FROM < cube name > WHERE { [Category].[Bikes], [Category].[Clothing] } ;

13

Subcube

SELECT … on Columns, … on Rows FROM ( SELECT { [Category].[Bikes], [Category].[Clothing] } on 0 FROM < cube name > ) ;

BID 302 | MDX Essentials for Report Design

Sets & Tuples

Set:

Combine members from same hierarchy using braces

{ [Year].[2005], [Year].[2006] }

Tuple:

Combine members from different hierarchies using parentheses

( [Category].[Bikes], [Year].[2006] )

14BID 302 | MDX Essentials for Report

Design

Manual & Generated MDX

The Graphical Query Designer• Slicers based on sub cubes• Multi-select Parameters• Dataset-driven lists• Levels

Manual Changes• Query formatting is ugly• Can’t go back to the GQD• Parameter support is limited

15BID 302 | MDX Essentials for Report

Design

Demo

<place holder>

16BID 302 | MDX Essentials for Report

Design

Aggregation & Calculations

Leverage the Analysis Services calculation & aggregation engineReporting Services will perform aggregations out of the boxOverride default SUM() and FIRST() function

Demo Miscalculated & Fixed Calculation

17BID 302 | MDX Essentials for Report

Design

Dynamic MDX Queries

The business user / developer dichotomyExpressionsAdd parametersCustom code function

Use calculated membersMigrate calculated members to the cube for reuse

18BID 302 | MDX Essentials for Report

Design

Prompts & Parameters

Use multi-select whenever possibleStandard prompts are most often appropriateCustom prompts can use expressions & string concatenation• Date ranges• Date picker prompt is designed for day-level

selection

19BID 302 | MDX Essentials for Report

Design

Demo

<place holder>

20BID 302 | MDX Essentials for Report

Design

Best Practices

Use the graphical query design to get started• Generate fields, parameters & parameter list

datasets

Save queries to script files

21BID 302 | MDX Essentials for Report

Design

Questions

?22

BID 302 | MDX Essentials for Report Design

October 11-14, Seattle, WA

Thank YouResources

Paul’s Blog……SqlServerBiBlog.com

SQL Server 2008 MDX Bryan C Smith, Ryan ClayMicrosoft Press

SQL Server 2008 Analysis Services Scott CameronMicrosoft Press

24

Complete the Evaluation Form to Win!Win a Dell Mini Netbook – every day – just for submitting your completed form. Each session evaluation form represents a chance to win.

Pick up your evaluation form:• In each presentation room• Online on the PASS Summit website

Drop off your completed form:• Near the exit of each presentation room• At the Registration desk• Online on the PASS Summit website

Sponsored by Dell

BID 300| Building a Reporting Infrastructure in SharePoint with SSRS 2008 R2

Thank you to our sponsorsGold

Prize BronzeBlog

BID 302 | MDX Essentials for Report Design 25