100 likes | 312 Vues
Colorado PASSCamp 2006. MDX Scripting. Mike White Wall Street On Demand. Agenda. Quick Scripting Overview Project Context (You want to do what?) Code Samples Your Questions. Colorado PASSCamp 2006. Scripting Overview - Scope. Coordinate space Tuples (2004,Pear,Order Count) = 99
E N D
Colorado PASSCamp 2006 MDX Scripting Mike White Wall Street On Demand
Agenda • Quick Scripting Overview • Project Context (You want to do what?) • Code Samples • Your Questions Colorado PASSCamp 2006
Scripting Overview - Scope • Coordinate space • Tuples • (2004,Pear,Order Count) = 99 • (2005) = 42 • Sets • (2003, {Apple, Orange}) = 11 • (Sales Amount, {Apple, Pear}) = 19.99 Colorado PASSCamp 2006
Scripting Overview - Scope • Scope limits enclosed assignments to the subcube it describes Scope(2003, {Apple, Pear}); (Order Count) = 17; (Sales Amount) = 34.50; End Scope; • Examples use simplified syntax and numeric “formulas”, but most any functions work Colorado PASSCamp 2006
Scripting Overview - Interface • Calculations Tab • Think of dropping formulas in Excel cells • Script vs. Form view • Metadata/Functions/Templates • Example – Simple calculation via form • What script does it generate? Colorado PASSCamp 2006
Project Context • Began spring 2005, database work functionally complete at SQL Server 2005 RTM • Made lots false starts – hopefully interesting ones • Application tracks drug usage of a sampled population, extrapolates usage (and associated patterns) of US population Colorado PASSCamp 2006
Project Context • Raw Data – as sampled. • Normalized Data –certain cases require factors to compensate for sampling error • Scaled Data – Factors scale data to US population based on incidence, sales, etc. Colorado PASSCamp 2006
Sample 1 - Scaling • Review Cube Structure • How would you implement? • Where do you store the factors? • What does the calculation look like? • How could my first draft be improved? Colorado PASSCamp 2006
Sample 2 - Normalizing • Applies to certain drugs and situations • Only drugs given by themselves • Ideas about how to incorporate complex join criteria in cube? Colorado PASSCamp 2006
Lessons Learned • Look for ways to reduce the coordinate space for the problem you are addressing • Simplify calculations by adjusting dimensions when possible • Pre-calculate everything possible (additive measures) Colorado PASSCamp 2006