SlideShare a Scribd company logo
MDX- Basics  Bragadishwaran U
MDX* – Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],* MDX – primarily Microsoft SSAS  cubes . (Also applicable to Hyperion  Essbase to  a large extent )
Understanding Dimensionality of Data representation ,[object Object],Account Year Investment 1 2010 100 2 2009 80 Account Investment 1 100 2 80 Account Year Product Investment 1 2010 A 100 2 2009 B 80
Understanding Dimensionality of Data representation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Columns (first dimension )  Rows (second dimension) “ So, what does exactly the word table mean?” “Ah, that’s just acronym for two-dimensional cube!” (From conversation of two DBAs in 2000) Account Year Investment 1 2010 100 2 2009 80
MDX Dimensionality  MDX queries arrange Cube Dimensions on the Representation Dimensions ( hereafter referred as ‘Axis’ to avoid confusion ) e.g. retrieve Planned GSV measure for accounts E4098,E4398. select     {   [Measures].[Planned GSV] }  on  0, { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47]   }  on  1 from  [Cube REPORTING]
MDX Query – Axis Framework MDX queries arrange Cube Dimensions on the Representation Dimensions ( hereafter referred as ‘Axis’ to avoid confusion ) e.g. retrieve Planned GSV measure for accounts E4098,E4398. select     {   [Measures].[Planned GSV] }  on   columns , { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47]   }  on   rows from  [Cube REPORTING] MDX provides names for each axis (till 4)
MDX query – Axis Framework MDX queries primarily  define Axis's  select     { something }  on   Axis (0), { Something else   }  on   Axis (1), from  [cube name] e.g.  select   { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47] } on   Axis (0), { [Measures].[Planned GSV]  }  on   Axis (1) from  [Cube REPORTING]
MDX query – Axis Framework MDX queries primarily  define Axis's  select     { something }  on   Axis (0), { Something else   }  on   Axis (1), from  [cube name] Something  ? Something = set or tuple Also note the structure of the basic MDX query
MDX query – tuple and SETS Tuples A  tuple  is a combination of members from one or more dimensions ->  not more than 1 member from a dimension  ( same rule as co-ordinate geometry ) * -> Many ways are there to specify a member. e.g. ( [Measures].[Planned GSV] ,[Time].[2010 HalfYear 1]  ) ( [Measures].[Planned GSV] ,[Time].&[64]) SETS A Set is an ordered collection of Tuples. select   { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47] } on   Axis (0), { ( [Measures].[Planned GSV] ,time.[2010 JAN]) ,( [Measures].[Planned GSV] ,[Time].[2010 HalfYear 1]  ) }  on Axis(0) () – for tuples {} – for sets * Actually its one member from each hierarchy in a dimension but lets not worry about this exception now .
Understanding  tuple Best analogy - coordinate geometry * 2D –space  Tuple of the form  (x 1 ,y 1  ) e.g. ( 3,4) Tuple like  (x 1 ,y 1  , y 2 ) or  (x 1 ,x 2  , y 2 ) are invalid  Now apply same concept to n- dimensional cube What are valid tuples ? (time.year.[2011] , Product.brand.[B1]) (time.year.[2011] , Product.brand.[B1] , time.year.[2010]) (time.year.[2011] , Product.brand.[B1], Geo.[India]) (time.year.[2011] , Product.brand.[B1], Product.brand.[B2]) * This analogy holds good except for hierarchies. Hierarchies in cube space can be considered as dimensions in Co-ordinate geometry Understanding tuples are key to thinking in MDX . We will stop here till all tuple  related queries are clarified.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MDX query – the children function .Children -- used to express the children of a member  e.g. as per Time hierarchy – month is the child of quarter select  { Time.[2010 Quarter 1]. children  } on  0, {[Account].[E4398:47]}  on  1 from  [Cube REPORTING]
MDX query – the Descendatns function Descendants ( member  [, [  level  ] [,  flag ]] ) -- used to express the Descendant  of a  member  at a  level  Flag allows display  Select  {[Account].[E4398:47]}  on  0, {  descendants (Time.[2010],month, self ) }  on  1 from  [Cube REPORTING] Select  {[Account].[E4398:47]}  on  0, {  descendants (Time.[2010],month, self_and_before ) }  on  1 from  [Cube REPORTING]
Assignment -1 Assume the following Dimensions :  Time  :  Year <- Quarter <- Month <- Day  Product :  Dollar Sales, Unit Sales  Geo : country <- state <- city
Cross joins Concept :  Two Sets - A ,B A = {1,2,3} B = {x,y} Cross join AxB AxB = { (1,x), (2,x), (3,x), (1,y), (2,y), (3,y),} Planned GSV for 2 accounts for 3 months --  select   { (account.[Account Code].[E4098:47]), (account.[Account Code].[E4400:47]) } *  -- cross join  { time.[2010 JAN] : time.[2010 MAR]  } on  0, { [Measures].[Planned GSV] } on  1 from   [Cube REPORTING]
Filter  Concept :  Filter  ( Set , Expression ) Accounts which have more than GSV select   filter   ( (account.[Account Code]. members ), [Measures].[Planned GSV] > 10000000 ) on  0, { [Measures].[Planned GSV]  } on  1 from   [Cube REPORTING] .members  gives all members of that level
Filter  What is the meaning of this ? select   filter   ( (account.[Account Code]. members ), ([Measures].[Planned GSV] ) > 10000000 )*  -- cross join  { time.[2010 JAN] : time.[2010 MAR]  } on  0, { [Measures].[Planned GSV]  } on  1 from   [Cube REPORTING]
Filter  And this ? select   filter   ( (account.[Account Code]. members ), ([Measures].[Planned GSV] , time.[2010 JAN] ) > 10000000 )*  -- cross join  { time.[2010 JAN] : time.[2010 MAR]  } on  0, { [Measures].[Planned GSV]  } on  1 from   [Cube REPORTING] Tuple reference is one of the powerful concepts in MDX
order  Concept :  Order (set1, expression  [, ASC | DESC | BASC | BDESC]) Accounts ordered by GSV select   non   empty  ( order   ( (account.[Account Code]. members ), ([Measures].[Planned GSV] )  ) ) on  0, { [Measures].[Planned GSV]  } on  1 from   [Cube REPORTING]
Accounts ordered by ??? select   non   empty  ( order   ( (account.[Account Code]. members ), ([Measures].[Planned GSV],time.[2011 JAN] )  ) ) on  0, { [Measures].[Planned GSV]  } on  1 from   [Cube REPORTING]
The Where Clause select   from   [Cube REPORTING] where   ([Measures].[Planned GSV] ) select   from   [Cube REPORTING] where   ([Measures].[Planned GSV],time.[2010 JAN] ) select   from   [Cube REPORTING] where   ([Measures].[Planned GSV],time.[2010 JAN] ,account.[Account Code].[E4400:47] ) Note : Where clause are a good way to identify invalid tuples Tuple instead of expression used
Named Sets  : Ease of reference  with   set  [great accounts]  as   { [Account].[Account Code].[E1373:47], [Account].[Account Code].[E40301:47] }  select { [Measures].[Planned GSV] } on  0, non   empty { [great accounts] }  on  1 from  [Cube REPORTING] Also possible to create persistent named Sets  create   set  [Cube REPORTING].[test accounts]  as   { [Account].[Account Code].[E1373:47], [Account].[Account Code].[E40301:47] }
Calculated members :  the power of MDX !!!! 1. Simple Calculated members  Find the  Average sales  price  ( i.e. Total Dollar sales /  number of units sold )  for the quarters  2005 Q1 and Q2. WITH MEMBER  [Measures].[Avg Sales Price]  AS [Measures].[Dollar Sales] / [Measures].[Unit Sales] SELECT { [Measures].[Dollar Sales] [Measures].[Unit Sales] , [Measures].[Avg Sales Price] } on   columns , { [Time].[Q1, 2005] , [Time].[Q2, 2005] } on   rows FROM  Sales Simple Division used to calculate a new measure    Dollar Sales  Unit Sales  Average Sales price Q1, 2005 100 5 20 Q2, 2005 120 8 15
Calculated members :  the power of MDX !!!! 2. Calculated members  of medium complexity Find the  Quarter on quarter growth for Dollar sales and unit sales for the quarters  2005  Q2. Growth in dollar sales = 2005 Q2 Dollar sales - 2005 Q1 Dollar sales  Growth in unit sales = 2005 Q2 unit sales - 2005 Q1 unit sales  WITH MEMBER  [Time].[Q1 to Q2 Growth]  AS [Time].[Q2, 2005] - [Time].[Q1, 2005] SELECT { [Measures].[Dollar Sales] , [Measures].[Unit Sales] } on   columns , { [Time].[Q1, 2005] , [Time].[Q2, 2005] , [Time].[Q1 to Q2 Growth] } on   rows FROM  Sales WHERE  ([Customer].[MA]) How does this take care of both subtractions ?
Calculated members :  the power of MDX !!!! Precedence resolutions  Combining  previous two problems , write MDX to calculate Q1 to Q2 growth in average Sales prices WITH MEMBER  [Measures].[Avg Sales Price]  AS [Measures].[Dollar Sales] / [Measures].[Unit Sales] MEMBER  [Time].[Q1 to Q2 Growth]  AS [Time].[Q2, 2005] - [Time].[Q1, 2005] SELECT { [Measures].[Dollar Sales], [Measures].[Unit Sales], [Measures].[Avg Sales Price] } on   columns , { [Time].[Q1, 2005], [Time].[Q2, 2005], [Time].[Q1 to Q2 Growth] } on   rows FROM  [Sales]
Calculated members :  the power of MDX !!!! Precedence resolutions  Combining  previous two problems , write MDX to calculate Q1 to Q2 growth in average Sales prices WITH MEMBER  [Measures].[Avg Sales Price]  AS [Measures].[Dollar Sales] / [Measures].[Unit Sales], SOLVE_ORDER  = 0 MEMBER  [Time].[Q1 to Q2 Growth]  AS [Time].[Q2, 2005] - [Time].[Q1, 2005], SOLVE_ORDER  = 1 SELECT { [Measures].[Dollar Sales], [Measures].[Unit Sales], [Measures].[Avg Sales Price] } on   columns , { [Time].[Q1, 2005], [Time].[Q2, 2005], [Time].[Q1 to Q2 Growth] } on   rows FROM  [Sales]
Calculated members :  the power of MDX !!!! Write an MDX to get the following result Measures -> Measures.[Sales Amount], Measures.[Total Cost] Dimensions -> Phase.Actual , Phase.Planned Use normal formulas for profit , percentage margin , amount of variance, percentage of variance.
References : Most of the concepts covered in this PPT have been Distilled from the below books
© 2008 MindTree Limited Imagination   Action   Joy

More Related Content

Viewers also liked

Annual Environmental Events
Annual Environmental EventsAnnual Environmental Events
Annual Environmental Events
WindTurbines.net
 
Simulations analysis with comparative study of a pmsg performances for small ...
Simulations analysis with comparative study of a pmsg performances for small ...Simulations analysis with comparative study of a pmsg performances for small ...
Simulations analysis with comparative study of a pmsg performances for small ...
Mellah Hacene
 
Wind
WindWind
Wind
WindWind
Reinventing Wind Turbines
Reinventing Wind TurbinesReinventing Wind Turbines
Reinventing Wind Turbines
WindTurbines.net
 
Basics Of Wind Power
Basics Of Wind PowerBasics Of Wind Power
Basics Of Wind Power
ckmapawatt
 
guaglobal.com
guaglobal.comguaglobal.com
guaglobal.com
GUA Global
 
Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...
Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...
Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...
BBIT Kolkata
 
MTA-BuildingPlace Sm Wind Turbine Regs
MTA-BuildingPlace Sm Wind Turbine RegsMTA-BuildingPlace Sm Wind Turbine Regs
MTA-BuildingPlace Sm Wind Turbine Regs
buildingplace
 
Catch The Wind Investor Presentation November 2009
Catch The Wind Investor Presentation November 2009Catch The Wind Investor Presentation November 2009
Catch The Wind Investor Presentation November 2009
TMX Equicom
 
Wind energy I. Lesson 8. Power losses at rotor blade
Wind energy I. Lesson 8. Power losses at rotor bladeWind energy I. Lesson 8. Power losses at rotor blade
Wind energy I. Lesson 8. Power losses at rotor blade
Tuong Do
 
Wind energy
Wind energyWind energy
Wind energy
Virenhk
 
Wind energy and constructional features
Wind energy and constructional featuresWind energy and constructional features
Wind energy and constructional features
Shanid Pazhamkavil
 
Power Electronics
Power ElectronicsPower Electronics
Power Electronics
Md Arifujjaman, PhD, PEng
 
WIND ENERGY
WIND ENERGYWIND ENERGY
WIND ENERGY
Vanita Thakkar
 
Wind For Students
Wind For StudentsWind For Students
Wind For Students
Sujith Praveen Kumar Asokan
 
Wind energy I. Lesson 7. Wind blade interaction
Wind energy I. Lesson 7. Wind blade interactionWind energy I. Lesson 7. Wind blade interaction
Wind energy I. Lesson 7. Wind blade interaction
Tuong Do
 
Theoretical and Design Analysis of SAVONIUS TURBINE
Theoretical and Design Analysis of SAVONIUS TURBINETheoretical and Design Analysis of SAVONIUS TURBINE
Theoretical and Design Analysis of SAVONIUS TURBINE
Rajeev Ranjan
 
Study About Wind turbines
Study About Wind turbinesStudy About Wind turbines
Study About Wind turbines
Elia Tohmé
 
Wind Turbine Report Final
Wind Turbine Report FinalWind Turbine Report Final
Wind Turbine Report Final
James Goddings
 

Viewers also liked (20)

Annual Environmental Events
Annual Environmental EventsAnnual Environmental Events
Annual Environmental Events
 
Simulations analysis with comparative study of a pmsg performances for small ...
Simulations analysis with comparative study of a pmsg performances for small ...Simulations analysis with comparative study of a pmsg performances for small ...
Simulations analysis with comparative study of a pmsg performances for small ...
 
Wind
WindWind
Wind
 
Wind
WindWind
Wind
 
Reinventing Wind Turbines
Reinventing Wind TurbinesReinventing Wind Turbines
Reinventing Wind Turbines
 
Basics Of Wind Power
Basics Of Wind PowerBasics Of Wind Power
Basics Of Wind Power
 
guaglobal.com
guaglobal.comguaglobal.com
guaglobal.com
 
Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...
Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...
Flow Physics analysis of Three-bucket Helical Savonius rotor at 90 degree twi...
 
MTA-BuildingPlace Sm Wind Turbine Regs
MTA-BuildingPlace Sm Wind Turbine RegsMTA-BuildingPlace Sm Wind Turbine Regs
MTA-BuildingPlace Sm Wind Turbine Regs
 
Catch The Wind Investor Presentation November 2009
Catch The Wind Investor Presentation November 2009Catch The Wind Investor Presentation November 2009
Catch The Wind Investor Presentation November 2009
 
Wind energy I. Lesson 8. Power losses at rotor blade
Wind energy I. Lesson 8. Power losses at rotor bladeWind energy I. Lesson 8. Power losses at rotor blade
Wind energy I. Lesson 8. Power losses at rotor blade
 
Wind energy
Wind energyWind energy
Wind energy
 
Wind energy and constructional features
Wind energy and constructional featuresWind energy and constructional features
Wind energy and constructional features
 
Power Electronics
Power ElectronicsPower Electronics
Power Electronics
 
WIND ENERGY
WIND ENERGYWIND ENERGY
WIND ENERGY
 
Wind For Students
Wind For StudentsWind For Students
Wind For Students
 
Wind energy I. Lesson 7. Wind blade interaction
Wind energy I. Lesson 7. Wind blade interactionWind energy I. Lesson 7. Wind blade interaction
Wind energy I. Lesson 7. Wind blade interaction
 
Theoretical and Design Analysis of SAVONIUS TURBINE
Theoretical and Design Analysis of SAVONIUS TURBINETheoretical and Design Analysis of SAVONIUS TURBINE
Theoretical and Design Analysis of SAVONIUS TURBINE
 
Study About Wind turbines
Study About Wind turbinesStudy About Wind turbines
Study About Wind turbines
 
Wind Turbine Report Final
Wind Turbine Report FinalWind Turbine Report Final
Wind Turbine Report Final
 

Similar to Mdx basics

Getting Started with MDX 20140625a
Getting Started with MDX 20140625aGetting Started with MDX 20140625a
Getting Started with MDX 20140625a
Ron Moore
 
MDX (Multi Dimensional Expressions) Introduction
MDX (Multi Dimensional Expressions) IntroductionMDX (Multi Dimensional Expressions) Introduction
MDX (Multi Dimensional Expressions) Introduction
Digvendra Singh
 
Calculation Groups - color 1 slide per page.pdf
Calculation Groups - color 1 slide per page.pdfCalculation Groups - color 1 slide per page.pdf
Calculation Groups - color 1 slide per page.pdf
PBIMINERADC
 
SSAS Project Profile
SSAS Project ProfileSSAS Project Profile
SSAS Project Profile
tthompson0421
 
Chris Seebacher Portfolio
Chris Seebacher PortfolioChris Seebacher Portfolio
Chris Seebacher Portfolio
guest3ea163
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
Chris Seebacher
 
With big data comes big responsibility
With big data comes big responsibilityWith big data comes big responsibility
With big data comes big responsibility
ERPScan
 
Dax queries.pdf
Dax queries.pdfDax queries.pdf
Dax queries.pdf
ntrnbk
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
eileensauer
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
eileensauer
 
Cubing and Metrics in SQL, oh my!
Cubing and Metrics in SQL, oh my!Cubing and Metrics in SQL, oh my!
Cubing and Metrics in SQL, oh my!
Julian Hyde
 
Mdx 2nddraft
Mdx 2nddraftMdx 2nddraft
Mdx 2nddraft
edarsoft
 
Agnes's SSAS Project Documentation
Agnes's SSAS Project DocumentationAgnes's SSAS Project Documentation
Agnes's SSAS Project Documentation
agnestetter
 
Programming in R
Programming in RProgramming in R
Programming in R
Smruti Sarangi
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answer
RaajTech
 
Nitin\'s Business Intelligence Portfolio
Nitin\'s Business Intelligence PortfolioNitin\'s Business Intelligence Portfolio
Nitin\'s Business Intelligence Portfolio
npatel2362
 
The Development of Financial Information System and Business Intelligence Usi...
The Development of Financial Information System and Business Intelligence Usi...The Development of Financial Information System and Business Intelligence Usi...
The Development of Financial Information System and Business Intelligence Usi...
IJERA Editor
 
William Schaffrans Bus Intelligence Portfolio
William Schaffrans Bus Intelligence PortfolioWilliam Schaffrans Bus Intelligence Portfolio
William Schaffrans Bus Intelligence Portfolio
wschaffr
 
8. Vectors data frames
8. Vectors data frames8. Vectors data frames
8. Vectors data frames
ExternalEvents
 
Ssas mdx language
Ssas mdx languageSsas mdx language
Ssas mdx language
Vinod Wilson
 

Similar to Mdx basics (20)

Getting Started with MDX 20140625a
Getting Started with MDX 20140625aGetting Started with MDX 20140625a
Getting Started with MDX 20140625a
 
MDX (Multi Dimensional Expressions) Introduction
MDX (Multi Dimensional Expressions) IntroductionMDX (Multi Dimensional Expressions) Introduction
MDX (Multi Dimensional Expressions) Introduction
 
Calculation Groups - color 1 slide per page.pdf
Calculation Groups - color 1 slide per page.pdfCalculation Groups - color 1 slide per page.pdf
Calculation Groups - color 1 slide per page.pdf
 
SSAS Project Profile
SSAS Project ProfileSSAS Project Profile
SSAS Project Profile
 
Chris Seebacher Portfolio
Chris Seebacher PortfolioChris Seebacher Portfolio
Chris Seebacher Portfolio
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
 
With big data comes big responsibility
With big data comes big responsibilityWith big data comes big responsibility
With big data comes big responsibility
 
Dax queries.pdf
Dax queries.pdfDax queries.pdf
Dax queries.pdf
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
 
Cubing and Metrics in SQL, oh my!
Cubing and Metrics in SQL, oh my!Cubing and Metrics in SQL, oh my!
Cubing and Metrics in SQL, oh my!
 
Mdx 2nddraft
Mdx 2nddraftMdx 2nddraft
Mdx 2nddraft
 
Agnes's SSAS Project Documentation
Agnes's SSAS Project DocumentationAgnes's SSAS Project Documentation
Agnes's SSAS Project Documentation
 
Programming in R
Programming in RProgramming in R
Programming in R
 
Chapter 16-spreadsheet1 questions and answer
Chapter 16-spreadsheet1  questions and answerChapter 16-spreadsheet1  questions and answer
Chapter 16-spreadsheet1 questions and answer
 
Nitin\'s Business Intelligence Portfolio
Nitin\'s Business Intelligence PortfolioNitin\'s Business Intelligence Portfolio
Nitin\'s Business Intelligence Portfolio
 
The Development of Financial Information System and Business Intelligence Usi...
The Development of Financial Information System and Business Intelligence Usi...The Development of Financial Information System and Business Intelligence Usi...
The Development of Financial Information System and Business Intelligence Usi...
 
William Schaffrans Bus Intelligence Portfolio
William Schaffrans Bus Intelligence PortfolioWilliam Schaffrans Bus Intelligence Portfolio
William Schaffrans Bus Intelligence Portfolio
 
8. Vectors data frames
8. Vectors data frames8. Vectors data frames
8. Vectors data frames
 
Ssas mdx language
Ssas mdx languageSsas mdx language
Ssas mdx language
 

Recently uploaded

Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 

Recently uploaded (20)

Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 

Mdx basics

  • 1. MDX- Basics Bragadishwaran U
  • 2.
  • 3.
  • 4.
  • 5. MDX Dimensionality MDX queries arrange Cube Dimensions on the Representation Dimensions ( hereafter referred as ‘Axis’ to avoid confusion ) e.g. retrieve Planned GSV measure for accounts E4098,E4398. select { [Measures].[Planned GSV] } on 0, { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47] } on 1 from [Cube REPORTING]
  • 6. MDX Query – Axis Framework MDX queries arrange Cube Dimensions on the Representation Dimensions ( hereafter referred as ‘Axis’ to avoid confusion ) e.g. retrieve Planned GSV measure for accounts E4098,E4398. select { [Measures].[Planned GSV] } on columns , { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47] } on rows from [Cube REPORTING] MDX provides names for each axis (till 4)
  • 7. MDX query – Axis Framework MDX queries primarily define Axis's select { something } on Axis (0), { Something else } on Axis (1), from [cube name] e.g. select { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47] } on Axis (0), { [Measures].[Planned GSV] } on Axis (1) from [Cube REPORTING]
  • 8. MDX query – Axis Framework MDX queries primarily define Axis's select { something } on Axis (0), { Something else } on Axis (1), from [cube name] Something ? Something = set or tuple Also note the structure of the basic MDX query
  • 9. MDX query – tuple and SETS Tuples A tuple is a combination of members from one or more dimensions -> not more than 1 member from a dimension ( same rule as co-ordinate geometry ) * -> Many ways are there to specify a member. e.g. ( [Measures].[Planned GSV] ,[Time].[2010 HalfYear 1] ) ( [Measures].[Planned GSV] ,[Time].&[64]) SETS A Set is an ordered collection of Tuples. select { [Account].[Account Code].[E4098:47] ,[Account].[Account Code].[E4398:47] } on Axis (0), { ( [Measures].[Planned GSV] ,time.[2010 JAN]) ,( [Measures].[Planned GSV] ,[Time].[2010 HalfYear 1] ) } on Axis(0) () – for tuples {} – for sets * Actually its one member from each hierarchy in a dimension but lets not worry about this exception now .
  • 10. Understanding tuple Best analogy - coordinate geometry * 2D –space Tuple of the form (x 1 ,y 1 ) e.g. ( 3,4) Tuple like (x 1 ,y 1 , y 2 ) or (x 1 ,x 2 , y 2 ) are invalid Now apply same concept to n- dimensional cube What are valid tuples ? (time.year.[2011] , Product.brand.[B1]) (time.year.[2011] , Product.brand.[B1] , time.year.[2010]) (time.year.[2011] , Product.brand.[B1], Geo.[India]) (time.year.[2011] , Product.brand.[B1], Product.brand.[B2]) * This analogy holds good except for hierarchies. Hierarchies in cube space can be considered as dimensions in Co-ordinate geometry Understanding tuples are key to thinking in MDX . We will stop here till all tuple related queries are clarified.
  • 11.
  • 12.
  • 13. MDX query – the children function .Children -- used to express the children of a member e.g. as per Time hierarchy – month is the child of quarter select { Time.[2010 Quarter 1]. children } on 0, {[Account].[E4398:47]} on 1 from [Cube REPORTING]
  • 14. MDX query – the Descendatns function Descendants ( member [, [ level ] [, flag ]] ) -- used to express the Descendant of a member at a level Flag allows display Select {[Account].[E4398:47]} on 0, { descendants (Time.[2010],month, self ) } on 1 from [Cube REPORTING] Select {[Account].[E4398:47]} on 0, { descendants (Time.[2010],month, self_and_before ) } on 1 from [Cube REPORTING]
  • 15. Assignment -1 Assume the following Dimensions : Time : Year <- Quarter <- Month <- Day Product : Dollar Sales, Unit Sales Geo : country <- state <- city
  • 16. Cross joins Concept : Two Sets - A ,B A = {1,2,3} B = {x,y} Cross join AxB AxB = { (1,x), (2,x), (3,x), (1,y), (2,y), (3,y),} Planned GSV for 2 accounts for 3 months -- select { (account.[Account Code].[E4098:47]), (account.[Account Code].[E4400:47]) } * -- cross join { time.[2010 JAN] : time.[2010 MAR] } on 0, { [Measures].[Planned GSV] } on 1 from [Cube REPORTING]
  • 17. Filter Concept : Filter ( Set , Expression ) Accounts which have more than GSV select filter ( (account.[Account Code]. members ), [Measures].[Planned GSV] > 10000000 ) on 0, { [Measures].[Planned GSV] } on 1 from [Cube REPORTING] .members gives all members of that level
  • 18. Filter What is the meaning of this ? select filter ( (account.[Account Code]. members ), ([Measures].[Planned GSV] ) > 10000000 )* -- cross join { time.[2010 JAN] : time.[2010 MAR] } on 0, { [Measures].[Planned GSV] } on 1 from [Cube REPORTING]
  • 19. Filter And this ? select filter ( (account.[Account Code]. members ), ([Measures].[Planned GSV] , time.[2010 JAN] ) > 10000000 )* -- cross join { time.[2010 JAN] : time.[2010 MAR] } on 0, { [Measures].[Planned GSV] } on 1 from [Cube REPORTING] Tuple reference is one of the powerful concepts in MDX
  • 20. order Concept : Order (set1, expression [, ASC | DESC | BASC | BDESC]) Accounts ordered by GSV select non empty ( order ( (account.[Account Code]. members ), ([Measures].[Planned GSV] ) ) ) on 0, { [Measures].[Planned GSV] } on 1 from [Cube REPORTING]
  • 21. Accounts ordered by ??? select non empty ( order ( (account.[Account Code]. members ), ([Measures].[Planned GSV],time.[2011 JAN] ) ) ) on 0, { [Measures].[Planned GSV] } on 1 from [Cube REPORTING]
  • 22. The Where Clause select from [Cube REPORTING] where ([Measures].[Planned GSV] ) select from [Cube REPORTING] where ([Measures].[Planned GSV],time.[2010 JAN] ) select from [Cube REPORTING] where ([Measures].[Planned GSV],time.[2010 JAN] ,account.[Account Code].[E4400:47] ) Note : Where clause are a good way to identify invalid tuples Tuple instead of expression used
  • 23. Named Sets : Ease of reference with set [great accounts] as { [Account].[Account Code].[E1373:47], [Account].[Account Code].[E40301:47] } select { [Measures].[Planned GSV] } on 0, non empty { [great accounts] } on 1 from [Cube REPORTING] Also possible to create persistent named Sets create set [Cube REPORTING].[test accounts] as { [Account].[Account Code].[E1373:47], [Account].[Account Code].[E40301:47] }
  • 24. Calculated members : the power of MDX !!!! 1. Simple Calculated members Find the Average sales price ( i.e. Total Dollar sales / number of units sold ) for the quarters 2005 Q1 and Q2. WITH MEMBER [Measures].[Avg Sales Price] AS [Measures].[Dollar Sales] / [Measures].[Unit Sales] SELECT { [Measures].[Dollar Sales] [Measures].[Unit Sales] , [Measures].[Avg Sales Price] } on columns , { [Time].[Q1, 2005] , [Time].[Q2, 2005] } on rows FROM Sales Simple Division used to calculate a new measure   Dollar Sales Unit Sales Average Sales price Q1, 2005 100 5 20 Q2, 2005 120 8 15
  • 25. Calculated members : the power of MDX !!!! 2. Calculated members of medium complexity Find the Quarter on quarter growth for Dollar sales and unit sales for the quarters 2005 Q2. Growth in dollar sales = 2005 Q2 Dollar sales - 2005 Q1 Dollar sales Growth in unit sales = 2005 Q2 unit sales - 2005 Q1 unit sales WITH MEMBER [Time].[Q1 to Q2 Growth] AS [Time].[Q2, 2005] - [Time].[Q1, 2005] SELECT { [Measures].[Dollar Sales] , [Measures].[Unit Sales] } on columns , { [Time].[Q1, 2005] , [Time].[Q2, 2005] , [Time].[Q1 to Q2 Growth] } on rows FROM Sales WHERE ([Customer].[MA]) How does this take care of both subtractions ?
  • 26. Calculated members : the power of MDX !!!! Precedence resolutions Combining previous two problems , write MDX to calculate Q1 to Q2 growth in average Sales prices WITH MEMBER [Measures].[Avg Sales Price] AS [Measures].[Dollar Sales] / [Measures].[Unit Sales] MEMBER [Time].[Q1 to Q2 Growth] AS [Time].[Q2, 2005] - [Time].[Q1, 2005] SELECT { [Measures].[Dollar Sales], [Measures].[Unit Sales], [Measures].[Avg Sales Price] } on columns , { [Time].[Q1, 2005], [Time].[Q2, 2005], [Time].[Q1 to Q2 Growth] } on rows FROM [Sales]
  • 27. Calculated members : the power of MDX !!!! Precedence resolutions Combining previous two problems , write MDX to calculate Q1 to Q2 growth in average Sales prices WITH MEMBER [Measures].[Avg Sales Price] AS [Measures].[Dollar Sales] / [Measures].[Unit Sales], SOLVE_ORDER = 0 MEMBER [Time].[Q1 to Q2 Growth] AS [Time].[Q2, 2005] - [Time].[Q1, 2005], SOLVE_ORDER = 1 SELECT { [Measures].[Dollar Sales], [Measures].[Unit Sales], [Measures].[Avg Sales Price] } on columns , { [Time].[Q1, 2005], [Time].[Q2, 2005], [Time].[Q1 to Q2 Growth] } on rows FROM [Sales]
  • 28. Calculated members : the power of MDX !!!! Write an MDX to get the following result Measures -> Measures.[Sales Amount], Measures.[Total Cost] Dimensions -> Phase.Actual , Phase.Planned Use normal formulas for profit , percentage margin , amount of variance, percentage of variance.
  • 29. References : Most of the concepts covered in this PPT have been Distilled from the below books
  • 30. © 2008 MindTree Limited Imagination Action Joy