![Page 2: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/2.jpg)
2
Mdx
Multi-Dimensional eXpression Parte della specifica OLEDB for OLAP Ora parte anche delle specifiche XML/A Nasce per reporting e analisi
![Page 3: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/3.jpg)
3
SQL vs MDX
SQL Relazionale Joins devono
essere specificati Non è
“Posizionale” Data dynamically
aggregated
MDX Multidimensionale Relazioni sono
definite nei metadati Posizionale Data referenced
![Page 4: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/4.jpg)
4
Mdx
Lo usiamo per• Query Statements
Per costruire reports (“simile” a SQL)• Formule
Membri calcolati (simile a Excel) Named Sets Subcube expression
• Management (limitato rispetto a Sql)• Alter Cube, Update Cube, etc.
![Page 5: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/5.jpg)
5
Mdx ogni cella ha un nome
All Product
Bread
Dairy
Meat
UnitsDollars
(Bread, USA, Units)(Bread, USA, Units)
([All Product], ([All Product], [All State],[All State],Dollars)Dollars)
(Meat, (Meat, Mexico,Mexico,Dollars)Dollars)
USA
Cana
da
Mexico
All S
tate
![Page 6: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/6.jpg)
6
Mdx
Tupla• Coordinate multidimensionali di una cella
1 membro da ogni dimensione Se piu’ dimensioni separo con , Va messa tra () e nome tra [] (non
obblig.) Se una dimensione non è specificata
usa membro corrente ([Measures].[Order Count],[Date].[Calendar
Year].&[2004])
![Page 7: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/7.jpg)
7
Mdx
Tuple da Row, Column, and Filter
([All State], [All Time], [Dairy],
[Sales Dollars])
([All State], [All Time], [Dairy],
[Sales Dollars])
![Page 8: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/8.jpg)
8
Mdx
Set Insieme di tuple della stessa
“dimensionalità”{([Measures].[Order Count],[Date].[Calendar Year].&[2004]),([Measures].[Order Count],[Date].[Calendar Year].&[2003])}
![Page 9: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/9.jpg)
9
Mdx
Mdx formule Nuove misure Nuovi membri
• Tuple based Average Price = [Sales Amount] / [Order Quantity] come riferimento Excel: =B5/B4
• Set based Year To Date = Sum( PeriodsToDate([Order Date].[Calendar
Quarter]),[Order Quantity]) Come Excel ranges: =Sum(B2:B10) ([Unit Sales],ancestor(Product,[Product].
[(All)]))
![Page 10: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/10.jpg)
10
Mdx
Autoexist Non ritorna attributi della stessa
dimensione che non esistono altri attributi Es Provincia , Comune
Se scelgo MI vedo solo i comuni della provincia di MI
Non ha niente che fare con i fact table Posso creare tupla che non ritorna nulla
MI -> Rimini
![Page 11: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/11.jpg)
11
Mdx
MDX Designer Nuovo ambiente centralizzato
Intellisense Color coding Debugger !!!!
Forms e Script Mode Forms piu’ semplice creare mdx Script Mode per utenti piu’ avanzati
![Page 12: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/12.jpg)
12
Mdx
Primo mdx script Calculated Member
Possibilità di organizzarli in folders Es:
[Measures].[Totale]/[Measures].[Qta] avg(topcount([Dim Clienti].[Dim Clienti].[Dim
Clienti].members,5,[Measures].[Totale]),[Measures].[Totale]) (attenzione a specificare oggetti corretti)
![Page 13: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/13.jpg)
13
Mdx “Lavorare” con il tempo
“Lavorare” con il tempo Importante la funzione CurrentMember
[dim tempo].[Year - Quarter - Month - Date].currentmember.name (o . Uniquename)
E la PrevMember ([dim tempo].[Year - Quarter - Month -
Date].currentmember.prevmember,[Measures].[Totale])
O meglio ([dim tempo].[Year - Quarter - Month -
Date].prevmember,[Measures].[Totale]) Crescita pp
([dim tempo].[Year - Quarter - Month - Date],[Measures].[Totale])-
([dim tempo].[Year - Quarter - Month - Date].prevmember,[Measures].[Totale])
![Page 14: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/14.jpg)
14
Mdx “Lavorare” con il tempo
ParallelPeriod Si potrebbe usare la funzione lag
Es lag(12) per anno Meglio parallelperiod
Parallelperiod(Livello,quanto,Membro) es (parallelperiod([dim tempo].[Year - Quarter -
Month - Date].[Year],1,[dim tempo].[Year - Quarter - Month - Date]),[Measures].[Totale])
![Page 15: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/15.jpg)
15
Mdx “Lavorare” con il tempo
Aggregazione YTD Funzione YTD, ritorna membri ad un livello da
inizio anno Es YTD([dim tempo].[Year - Quarter - Month - Date].
[Month].&[2003-03-01T00:00:00]) /* Marzo 2003*/ Torna
Gennaio 2003 Febbraio 2003 Marzo 2003
Funzione QTD stessa cosa su quarter Funzione PeriodsToDate specifico data inizio
![Page 16: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/16.jpg)
16
Mdx altri esempi
Percentuale rispetto al totale Funzione Root, ritorna All di una dimensione Es
root([Dim Clienti]) ([Measures].[Totale]) / (root([Dim Clienti]),
[Measures].[Totale]) Percentuale rispetto al padre
Parent ritorna il membro padre Es
[Dim Clienti].[Provincia - Comune].CurrentMember.Parent
( [Dim Clienti].[Provincia - Comune],[Measures].[Qta] ) /( [Dim Clienti].[Provincia - Comune].Parent,
[Measures].[Qta] )
![Page 17: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/17.jpg)
17
Mdx non solo misure
Media di una gerarchia Avg(avg([Dim Clienti].[Comune].
[Comune].members) La associo ad una gerarchia Ed ad un Parent Member
![Page 18: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/18.jpg)
18
Mdx
NamedSet Set già pronto al interno del udm Es top n
topcount([Dim Clienti].[Comune].[comune].members,5,[Measures].[Totale])
![Page 19: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/19.jpg)
19
Mdx
MDX query È composta da 3 parti
– Dicers: assi (normalmente Column e Row)– Data Grid – riempita dalla risoluzione degli assi– Slicers: Filtro
SELECT <Set> On Columns,<Set> On Rows
FROM <Cube> WHERE <Slicers>
![Page 20: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/20.jpg)
20
Set
<x>.Members Descendants or Children se sono in una
gerarchia Membri espliciti in {}
{[Sales Amount],[Order Quantity]} Membro singolo {} non obbligatorio
SELECT [Sales Amount] ON 0, [Category].Members ON RowsFROM [Adventure Works];
![Page 21: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/21.jpg)
21
Assi
<Set> ON <Axis> Columns 0 Rows 1
NON EMPTY rimuove celle vuote
SELECT NON EMPTY [Measures].Members ON 0, NON EMPTY [Category].Members ON RowsFROM [Adventure Works];
![Page 22: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/22.jpg)
22
Mdx
Funzioni (tra le piu’ usate) Order Head/Tail TopCount Filter Crossjoin (*) Except (-) Generate
![Page 23: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/23.jpg)
23
Mdx
Attributi aggiuntivi Hierarchize (ordina dimensione) NON EMPTY (toglie righe vuote) CELL PROPERTIES Formatted_Value;
![Page 24: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/24.jpg)
24
ADOMD.Net
Nuova versione .Net of ADOMD ADOMD.Net in AS2005
.Net wrapper for XML/A SOAP calls Non fa parte di Sql 2005
Già rilasciato in AS2K, XML/A “parla” con
PivotTable Service (PTS) in Sql 2005, XML/A diretto al server
![Page 25: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/25.jpg)
25
ADOMD.Net
Cubes Cube
Dimensions Dimension
Hierarchies Hierarchy
Levels Level
Members Member
Properties
Measures
Measure
![Page 26: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/26.jpg)
26
ADOMD.Net
CellSet
Axes Axis
Cells Cell
Set
Tuples Tuple
Members Member
Connection
Command
Set
CellSet is instantiated byExecuting on Command object
Tuple
![Page 27: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/27.jpg)
27
Client Metadata
Struttura del cubo. CubeDef Class
Dimension Hierarchy Level Member
![Page 28: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/28.jpg)
28
Query Execution
Invia MDX via AdomdCommand Standard MDX
Torna CellSet Griglia multidimensionale
![Page 29: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/29.jpg)
29
CellSet Structure
Axes Sets Tuples Terminologia cambiata da adomd per
essere piu’ aderente a MDX Data Values (array multidimensionale)
Index è (n,m) array element
![Page 30: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/30.jpg)
30
CellSet metadata
Metadati sono disponibile dal CellSet OlapInfo AxesInfo CellsInfo CubesInfo
![Page 31: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/31.jpg)
31
Domande?
![Page 32: Mdx Franco Perduca Factory Software francop@factorysw.com](https://reader033.vdocuments.mx/reader033/viewer/2022051616/5542eb4b497959361e8b7987/html5/thumbnails/32.jpg)
© 2004 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.