1 / 48

Cubes for Flat Table Land

This informative guide compares and contrasts PowerPivot and SSAS Tabular Model, highlighting their strengths and weaknesses. Learn about DAX, data import options, and which model suits your needs. Dive into the world of data analysis with expert insights from Michael P. Antonovich. Stay informed and make the right choices for your analytics projects.

jonathane
Download Presentation

Cubes for Flat Table Land

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. Cubes for Flat Table Land Michael P. Antonovich http://SharePointMike.wordpress.com #SharePointMikeA

  2. My Published Books • User’s Guide to the Apple ][ - 1983 • FoxPro 2 Programming Guide – 1992 • Debugging and Maintaining FoxPro – 1992 • Using Visual FoxPro 3.0 – 1995 • Using Visual FoxPro 5.0 – 1996 • Office and SharePoint User’s Guide – 2007 • Office and SharePoint User’s Guide – 2010 Speaker at: Code Camp 2009, 2010, 2011, 2012 Orlando SharePoint Saturday 2011 & 2012 Tampa, 2012 Orlando SQL Saturday - #1, #4, #8, #10, #15, #16, #21, #32, #38, #49, #62, #74, #79, #85, #86, #110, #130, #151, #168 IT PRCamp – Jacksonville 2012 OPASS Mtg

  3. Some Basic BI Terminology OPASS Mtg

  4. Two Models in SSAS • Multidimensional Model • No major functionality changes since 2008 R2 • Tabular Model • Visually and functionally resembles PowerPivot 2012 • Both can be installed as separate instances on the same server. OPASS Mtg

  5. Advantages of the MultiDimensional Model • Tested technology since SQL 2000 • Pre-calculated aggregates provide performance enhancements. • Can handle larger data since it can store data on disk (MOLAP) or directly query the relational data source (ROLAP) • Uses MDX which is supported by many 3rd party client tools. OPASS Mtg

  6. Disadvantages of the MultiDimensional Model • Model is getting ‘old’ and is not being revised. (designed for 32 bit, row based data and disk storage). • MDX is perceived as being difficult to learn. • Processing a multidimensional model can result in substantial downtime for large models. • Changes to one table require the entire model to be reprocessed. • Not compatible with PowerPivot OPASS Mtg

  7. Advantages of the Tabular Model • A 100% memory-based model provides greater performance. • The xVelocity analytics column based engine offers significant query performance improvements. • Queries and formulas use DAX which is ‘easier’ to learn than MDX. (MDX is also supported) • Queries data from many different data sources. OPASS Mtg

  8. Disadvantages of the Tabular Model • Does not support many-to-many relationships. • Does not support true role-playing dimensions. • Does not support cell-level security. • Does not support security on measures. • Does not support translations of metadata for locales. • Does not support ragged hierarchies. OPASS Mtg

  9. Which to Choose? • For most applications (60-70%) either model will work. • Do you currently have a model in Multidimensional mode? • Are you just learning Analysis Services? • Licensing issues? • Compatibility with PowerPivot? • Hardware? • Performance Issues? OPASS Mtg

  10. SSAS Tabular Uses DAX DAX Stands for Data Analysis Expressions • DAX is used to: • Create calculated columns • Create custom measures OPASS Mtg

  11. Basic Syntax • DAX expressions always begin with an equal sign: = • Column References can be qualified or unqualified • TableName[ColumnName] • [ColumnName] DAX Operators DAX Data Types Integer Real Currency Date(DateTime) TRUE/FALSE (Boolean) Text +, - *, / =, <> >,< >=, <= & AND && OR || NOT ! OPASS Mtg

  12. DAX Functions • 2010 Version consisted of 135 functions • 71 functions are similar to Excel functions • 69 have the same name – 2 do not • TEXT  FORMAT • DATEDIF  YEARFRAC • 64 functions are unique to DAX • Aggregate data functions • Date related functions 2012 Version has a little over 170 functions (no, I will not cover them all today) OPASS Mtg

  13. Types of DAX Calculations • Simple Calculations • Calculated columns within fact tables • Calculated columns for dimension tables • Calculated columns between tables • Calculated columns to eliminate lookup tables • Calculated columns to serve as links to tables using multiple columns (Calculated columns are calculated for every row in the table) Context is the row • Aggregate Calculations • Calculate unique measures • Context is in the evaluation of the pivot data (Aggregate measures are only calculated for the displayed data in the Pivot table) OPASS Mtg

  14. Tabular Model Can Import From • Microsoft Access 2003, 2007, 2010 • Microsoft SQL Server 2005, 2008, 2008 R2 • Oracle Relational DB 9i, 10g, 11g • Teradata V2R6, V12 • IBM Relational Database 8.1 • Sybase Relational Databases • Many other ODBC Databases • Text files (.txt, .tab, .csv) • Analysis Services Cubes from SQL Server • Data Feeds using Atom 1.0 Format • Excel Files from 97-2003, 2007, 2010 OPASS Mtg

  15. Demo 1a: Retrieve Data from Multiple Sources • Open C:\Contoso2012\Stores.xlsx and rename to C:\Contoso2012\SQLSaturday1.xlsx • Go to PowerPivot window and load SQL Server database: Contoso2012 using all tables • Add to Data Model, Stores from the current spreadsheet. This is a linked table. • Add Access database ProductCategories. • Add Excel file: Geography.xlsx OPASS Mtg

  16. Demo 1a: Load Data OPASS Mtg

  17. Loading Data into the Tabular Model • Demo OPASS Mtg

  18. Demo 1b: Create Relationships OPASS Mtg

  19. Demo 1c: Show Diagram View OPASS Mtg

  20. Creating Relations Between Tables • Demo OPASS Mtg

  21. Technical vs. Useless Columns • Technical Columns • Used to link tables (IDs) • Use to calculate other columns • Hide from Pivot Table Field List • Useless Columns • Came in when data imported from data source • Not used in pivot table or to link tables • Delete to improve performance OPASS Mtg

  22. Demo 2: Eliminate Useless Columns and Hide Technical Columns OPASS Mtg

  23. Denormalize Data Model • Eliminate tables and columns that are not going to be used. • Flatten structure by created calculated dimension attributes based on values in other tables. • Hide columns used in calculations but which users no longer need to see. OPASS Mtg

  24. Create a Hierarchy • Predefine common hierarchies for users • Hierarchies are defined from the largest grouping to the smallest: • Product Category • Product Subcategory • Product • After defining the hierarchy, you can remove the individual columns used to define the hierarchy. OPASS Mtg

  25. Demo 3: Define a Product Hierarchy OPASS Mtg

  26. Demo 4: Demo of Cube (so far) Using Excel Pivot OPASS Mtg

  27. Building Hierarchies • Demo OPASS Mtg

  28. Create a Calculated Measure For those times when a built-in measure just isn’t enough… …you need a custom measure creating using DAX to satisfy the need. What is new in 2012 is that calculated measures can now be defined in the calculation area of the fact table. OPASS Mtg

  29. Creating Custom DAX Measures • For example, suppose you want to display the percent increase or decrease in sales by product in your stores channel for this year vs last year. • You need a new measure to calculate store sales: • StoreSales:=CALCULATE(SUM([SalesAmount]),DimChannel[ChannelName]="Store") • By default, the above calculates sales for the entire table. However, in the pivot table, we can use the dimension: YEAR as a filter or slicer to perform the calculation by each year in the table. OPASS Mtg

  30. Dimensions Serve as Filters • Use Time Functions to calculate measures for other time periods. • LastYrSales:=CALCULATE([StoreSales], DATEADD(DimDate[Datekey],-1,year)) • The above expression allows us to reference an existing expression but apply an additional filter to the calculation of StoreSales (which is already filtering on the channel: store). That additional filter in this case calculates the Store sales for the date one year prior to the current date of the record. OPASS Mtg

  31. Calculate the Percent Change in Sales • Given the prior two calculated measures, store sales for the current year and store sales for the prior year for each period in the cube, you can now calculate the percent change using an expression like: • YearlyGrowth:=([StoreSales]-[LastYrSales])/[LastYrSales] OPASS Mtg

  32. Using Error Checking Actually, the above sample works only because the slicer limited the calculations to specific years. However, in general, you need to check equations for error conditions like dividing by zero by using a formula more like: YearlyGrowth:=IF(ISBLANK([StoreSales]) || ISBLANK([LastYrSales]), 0, ([StoreSales]-[LastYrSales])/[LastYrSales]) OPASS Mtg

  33. Demo 5a: Define a Calculated Measure OPASS Mtg

  34. Demo 5b: The Pivot Table with Calculated Measures OPASS Mtg

  35. Turning a Calculated Measure into a KPI • KPI are nothing more than calculated measures in a fact table that are compared to a target value to determine whether the value is good or bad. OPASS Mtg

  36. Adding KPI Calculations • What is a KPI? Key Performance Indicator • Key Performance Indicators provide information at a glance to indicate status of a measureable fact about your company/organization OPASS Mtg

  37. Adding KPI Calculations • A KPI Needs: • A Base Value • A Target Value • A number of status intervals • Thresholds for each interval • Symbols to use to indicate status OPASS Mtg

  38. Demo 6a: Using DAX to Create a KPI OPASS Mtg

  39. Demo 6b: Using DAX to Create a KPI OPASS Mtg

  40. Adding a KPI • Demo OPASS Mtg

  41. Sorting by Other Fields • You notice in the previous demo that while the rows displayed the sales by month, the months were sorted alphabetically, not chronologically. • No one will accept that. • How can you sort the months correctly. • PowerPivot 2012 introduces a Sort by Another Column feature! OPASS Mtg

  42. Define a Calculated Column with the Month # OPASS Mtg

  43. Associate the Month Label with the New Column OPASS Mtg

  44. Demo 6c: Correctly Ordered Months OPASS Mtg

  45. Sorting on Alternate Columns • Demo OPASS Mtg

  46. Useful Links • My blog is running a series of articles on working with the Tabular model • http://SharePointMike.wordpress.com • Using the SSAS Tabular Model Week 1 • http://sharepointmike.wordpress.com/2012/10/06/using-the-ssas-tabular-model-week-1/ • Gathering Data From Different Data Sources Week 2 • http://sharepointmike.wordpress.com/2012/10/13/using-the-ssas-tabular-model-week-2/ • Displaying your first Pivot Table from a Tabular Model • http://sharepointmike.wordpress.com/2012/10/20/using-the-ssas-tabular-model-week-3/ • Hierarchies • http://sharepointmike.wordpress.com/2012/10/27/using-the-ssas-tabular-model-week-4-hierarchies • http://sharepointmike.wordpress.com/2012/11/03/using-the-ssas-tabular-model-week-5-hierarchies-2 • KPIs • http://sharepointmike.wordpress.com/2012/11/10/using-the-ssas-tabular-model-week-6-kpi • Clean-Up in Week 7 • http://sharepointmike.wordpress.com/2012/11/17/using-the-ssas-tabular-model-clean-up-in-week-7 • DAX On-line Function Reference • http://technet.microsoft.com/en-us/library/ee634396.aspx OPASS Mtg

  47. Got Questions? OPASS Mtg

  48. Thank You Don’t forget your evaluations. Michael P. Antonovich Mike@micmin.org Blog site: http://sharepointmike.wordpress.com/ OPASS Mtg

More Related