1 / 18

MDX Gotcha! s

MDX Gotcha! s. … or how to keep your hair dark…. Your Speaker. Boyan Penev Microsoft MVP: SQL Server for 2011 Expertise SSAS PowerPivot SSRS SSIS e tc, etc, etc (you get the point ;) Blog: www.bp-msbi.com. Quick Agenda. MDX Problems

gillian
Download Presentation

MDX Gotcha! s

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MDXGotcha!s …or how to keep your hair dark…

  2. Your Speaker • Boyan Penev • Microsoft MVP: SQL Server for 2011 • Expertise • SSAS • PowerPivot • SSRS • SSIS • etc, etc, etc (you get the point ;) • Blog: www.bp-msbi.com

  3. Quick Agenda • MDX Problems • Incorrect Data Models • Under-used SSAS functionality • Inefficient MDX • Detecting Problems • Demo (some examples)

  4. MDX Problems (re: Data Model) Leaf-Level Calculations • SUM(DESCENDANTS(<member>,,LEAVES), <measure1>/<measure2>) • SCOPE(LEAVES(<dimension>); This = <measure1>/<measure2>; END SCOPE; • Alternatives • ETL, DB Views, DSV: <measure1>/<measure2> • Demo

  5. Leaves

  6. MDX Problems (re: Data Model) Date Calculations • ParallelPeriod() • ClosingPeriod() • YTD(), QTD(), MTD() Common Causes • Incomplete Date Dimensions (gaps, missing members) • Wrong Structure (hierarchies, attrels) • Dimensions not marked as Time

  7. ParallelPeriod(Quarter, Apr 08)= Mar 08 Closing Period(Q3 08) = Aug08

  8. MDX Problems (re: SSAS Functionality) Semi-Additive Measures in EE • Replicating the same behaviour in MDX Many 2 Many Relationships • Performing SQL-style JOINs in MDX Measure Expressions • Writing them in MDX • Note that aggregations are not used with MEs

  9. FactA.MeasureA (+-*/)FactB.MeasureB

  10. MDX Problems (re: Inefficient MDX) Using IIF instead of SCOPE (> importance in 2005) • IIF(a.CurrentMember Is <a.member>, NULL, <measure>)is the same (functionally) as:SCOPE(<a.member>); This = NULL;END SCOPE;

  11. MDX Problems (re: Inefficient MDX) Set Operations • Filter(<d>.<h>.<l>, <d>.<h>.CurrentMember.MemberValue < 20110315) is equivalent to: {NULL:<d>.<h>.<l>.&[20110315]} • Demo

  12. MDX Problems (re: Inefficient MDX) Using VBA/Excel Functions • VBA!Format() ~ FORMAT_STRING • VBA!DateAdd() = <d>.<h>.<l>.<m>.NextMember, or<d>.<h>.<l>.<m>.PrevMember, or<d>.<h>.<l>.<m>.Lag(n), or<d>.<h>.<l>.<m>.Lead(n) • VBA!DateDiff() ={<d>.<h>.<l>.<m>: <d>.<h>.<l>.<m>}.Count • Demo

  13. MDX Problems (re: Inefficient MDX) • StrToSetand StrToMember • Use sparingly • LinkMember, LookupCube • Avoid at all costs • Filter • Often over-used, be cautious

  14. Detecting Problems • Execution Time • SQL Server Profiler • Excessive number of data requests • Touching too many partitions and aggregations • Performance Monitor • Several SSAS MDX counters • Bulk mode evaluation nodes • Cell-by-Cell evaluation nodes • Number of cells evaluated • Memory/CPU Utilisation

  15. Q…and hopefully some A

More Related