分析性報表的開發 —使用Cube技術

Preview:

Citation preview

分析性報表的開發 —使用 Cube 技術

也文數位科技 羅宇倫http://www.yaw.com.tw ( 也文官網 )

http://www.123hi.org ( 教學平台 )

報表的分類 分類一

• 明細報表• 分析性報表

分類二• 單一系統來源報表• 跨系統來源報表

OLAP ( 線上分析處理 On-Line Analytical Processing)

能即時的、快速的,提供整合性的決策資訊。 主要目的在支援決策資訊的分析而非線上交易處理

(OLTP) 。 常需擷取非常大量的歷史資料 ( 趨勢分析 ) 。 常需對多維度及彙整型的資訊進行複雜的分析。 常需以不同時間表來比較,如年、月、季、週。 使用者所需的資料已經事先定義並計算完成,因此查

詢速度快。

資料倉儲的完整架構

BusinessUsers

Cognos PowerPlay & Impromptu

OLAP Server

Cubes

帳務系統資料

Extract

Transport

Transform and Load

OLAPOLAP

OLAPOLAP

OSS

OLAPOLAP

Data Warehouse

客戶通話明細資料

客戶服務資料

行動網站服務資料

預付卡客戶資料

ETL Server

ETLAdmin

ETL 3.0 Client

Cube

Cube 是線上分析處理 (OLAP) 中最主要的物件,而線上分析處理是提供在資料倉儲中快速存取資料的一種技術。

Cube 是從資料倉儲子集合所建立的資料集合,且其被組織及摘要成為一組由維度與量值所定義的多維度結構。

Cube 提供容易使用並具有快速且一致回應時間的查詢資料機制。

Analysis Server 可以支援許多不同 Cube ,例如銷售 Cube 、庫存 Cube 和顧客 Cube 等

建立 Cube 之元素

Fact TableMeasures 量值Dimensions 維度

Ex : 以不同的觀點 ( 條件 ) 來看營運資訊( 資料 )• 觀點 / 條件 維度 (Dimension)

• 營運資訊 / 資料 量值 (Measure)

Cube

Star Schema

Fact TableDimension Table

Employee_DimEmployee_DimEmployee_DimEmployee_DimEmployeeKeyEmployeeKey

EmployeeID...EmployeeID...

Time_DimTime_DimTime_DimTime_DimTimeKeyTimeKey

TheDate...TheDate...

Product_DimProduct_DimProduct_DimProduct_DimProductKeyProductKey

ProductID...ProductID...

Customer_DimCustomer_DimCustomer_DimCustomer_DimCustomerKeyCustomerKey

CustomerID...CustomerID...

Shipper_DimShipper_DimShipper_DimShipper_DimShipperKeyShipperKey

ShipperID...ShipperID...

Sales_FactSales_FactTimeKeyEmployeeKeyProductKeyCustomerKeyShipperKey

TimeKeyEmployeeKeyProductKeyCustomerKeyShipperKey

Sales AmountUnit Sales ...Sales AmountUnit Sales ...

量值 (Measures) 在 Cube 中,量值是一組以 Cube 的事實資料表

(Fact Table) 中的資料行為根據 ( 通常是數值型 ) 的數值。

量值是經過分析的 Cube 的中間值。也就是說,量值是使用者瀏覽 Cube 時最感興趣的數值型資料。

選取的量值要看使用者要求的資訊型別而定,常見的一些量值是銷售額、成本、支出以及產量。

對於 Cube 中的各個量值,除了其他量值的資料格之外,Cube 含有每個資料格的數值。所以,不論查詢中用的是那一種成員組合,都可以擷取到一個量值數值。

一個 Cube 最多可以含有 1,024 個量值

維度 (Dimension) 維度是 Cube 的結構屬性。它們是有組織的類別階層架構 ,

說明事實資料表中的資料。 這些類別與層級說明類似的成員,做為使用者資料分析的

基礎。 一個 Cube 最多可以含有 128 個維度 OLAP 最大的功能就是提供多維度的分析模組,其內

容不外乎:人、事、時、地、物,即所謂的 4W1H 。• 以時間的維度 (Dimension) 來說,可以細分為 : 年、

季、月、週、日,本年、去年,本季、上季,本月、上月 ... 。

• 以產品的 Dimension 又可分為:大分類、中分類、小分類,產品 ... 。如下圖所示:

維度

Cube / Dimension / Measure

組織別產品別

用戶別

時間

合約狀態

Cube

Dimension

Measure線數

流量

營收

Cube

What does the “Cube” Look Like ?

Data Cube 資料方塊法 資料方塊法的一般概念為具體化一些經常被要

求的高成本計算

尤其是計數 (count) 、總計 (sum) 、求平均數(average) 、取最大值 (max) 等函數

將具體化後的景觀儲存在一個資料方塊,可供決策支援、知識發現及其他應用做參考

OLAP 的特色 OLAP 的兩大特色,就是可以讓使用者

輕鬆快速的作• 逐層分析 (Drill-Down)

• 交叉分析 (Slice & Dice)

如此將原始資料加值成有意義的資訊。

AS 中 Cube 的編輯

AS 中 Cube 的瀏覽資料

Client 端瀏覽 Cube 資料—使用 PowerPlay

Client 端瀏覽 Cube 資料—使用 Excel

SQL2000 的報表服務架構

AnalysisAnalysis ServicesServices

Data Transformation ServicesData Transformation Services

XML support, 32 / 64 bitXML support, 32 / 64 bit

開發開發

工具工具

管理管理

工具工具

OLAP & Data MiningOLAP & Data Mining

商業智慧商業智慧

資料轉換服務資料轉換服務

資料庫資料庫

報表服務報表服務Reporting ServicesReporting Services

報告完畢,敬請指教

Recommended