www.it-ebooks.info www.it-ebooks.info Developing Business Intelligence Apps for SharePoint David Feldman and Jason Himmelstein www.it-ebooks.info Developing Business Intelligence Apps for SharePoint by David Feldman and Jason Himmelstein Copyright © 2013 Jason Himmelstein, David Feldman All rights reserved Printed in the United States of America Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O’Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://my.safaribooksonline.com) For more information, contact our corporate/ institutional sales department: 800-998-9938 or corporate@oreilly.com Editor: Rachel Roumeliotis Production Editor: Christopher Hearse Copyeditor: Gillian McGarvey Proofreader: Charles Roumeliotis June 2013: Indexer: Ellen Troutman Zaig Cover Designer: Randy Comer Interior Designer: David Futato Illustrator: Rebecca Demarest First Edition Revision History for the First Edition: 2013-06-28: First release See http://oreilly.com/catalog/errata.csp?isbn=9781449320836 for release details Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc Developing Business Intelligence Apps for SharePoint, the image of an Eastern Kingbird, and related trade dress are trademarks of O’Reilly Media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN: 978-1-449-32083-6 [LSI] www.it-ebooks.info Table of Contents Preface xiii Part I SharePoint, Apps, and Business Intelligence So What Does All This Have to Do with Business Intelligence? Choosing the Right Tools for the Job Technology Selection Goals Solution Components Visual Studio LightSwitch SharePoint Server 2010-2013 SharePoint Development: Past, Present, and Future Farm Solutions: SharePoint 2007 Sandbox Solutions and CSOM: SharePoint 2010 The Cloud App Model with Apps for SharePoint: SharePoint 2013 Our Strategy SQL Server 2012 for Business Intelligence Summary 6 10 11 12 13 14 16 16 17 Basic Concepts of Relational Database Design 19 Normalization First Normal Form: Stop repeating yourself Second Normal Form: The Whole Key Third Normal Form: Nothing but the Key Bringing It All Together Many-to-Many Relationships 19 20 22 24 25 25 iii www.it-ebooks.info Summary 26 Part II Why You Need LightSwitch 29 Traditional SharePoint Development Is Difficult Custom Development Is Tedious Build Custom Apps, Coding Optional 29 30 32 Start with Data 33 Defining Basic Fields and Data Types Using the Properties Window Enhancing a String with a Choice List Setting Default Values Adding Relationships Business Types Defining Uniqueness Practicing What We Just Learned Calculated Computed Properties Advanced Relationships Summary 34 35 36 37 39 42 43 43 44 45 45 Screens: The LightSwitch User Interface 47 Creating Screens Using Read-Only Controls Displaying Related Fields Launching the Application for the First Time Creating a Modal Window Summary 48 49 51 52 55 58 Adding Business Logic 59 Change Tracking in LightSwitch Factoring Out Repeated Logic Customizing the Add and Edit Buttons Designing Running Screens Creating a Custom Details Page Custom Validation Summary 61 62 63 68 70 73 75 Application Security, Access Control, and Personalizing Your Application 77 Enabling Authentication: Windows or Forms iv | Table of Contents www.it-ebooks.info 77 Adding a Welcome Message Using Our ViewModel Adding a Query to the Model Add the Query to the Screen (ViewModel) Binding to Query Parameters Summary 79 84 85 86 89 Running and Debugging Our Application 91 The LightSwitch Runtime Experience The LightSwitch Grid Control Sorting Export to Excel Search What’s Really Happening Between Our Client and the Server? Running as a Web Application Summary 91 91 91 91 92 92 93 96 10 LightSwitch with SharePoint Data 97 Logical SharePoint Architecture Adding a SharePoint Data Source Relating to SharePoint Data Populating the Knowledge Base Summary 97 103 106 108 112 11 Deploying Your LightSwitch Application 113 The Application Designer The Publishing Wizard What Kind of Application Do You Want to Deploy? Where Will the Application’s Services Be Hosted? Remotely Publish the App or Just Package It for Now? Do You Need an SSL Certificate? How Will You Deploy Your Database? Should LightSwitch Create an Application Administrator Account? Specify Other Connection Information Signing Your Code Ready to Deploy Deploying Your Packages to the Server A First Look at the Database Summary 113 114 114 115 116 117 118 119 120 121 122 123 134 135 Part III Table of Contents www.it-ebooks.info | v 12 Introduction to Business Intelligence 139 What Is Business Intelligence? Applications of Business Intelligence Microsoft’s Tools for Business Intelligence SQL Server Database Engine SQL Server Analysis Services (Prior to 2012) PowerPivot for Excel and SharePoint Summary 139 140 141 143 144 145 147 13 Business Intelligence Semantic Model (BISM) 149 Why Business Intelligence Semantic Model? BISM Design Goals Business Intelligence Semantic Model Architecture Consuming Data from OData Sources How Do Existing Analysis Services Applications Translate to the New Semantic Model? Pros and Cons of the New BI Tabular Data Model How Do the Data Access Methodologies Stack Up? xVelocity (Tabular) MOLAP (UDM) ROLAP (UDM) DirectQuery (Tabular) Business Logic DAX Syntax Getting Started with DAX 149 149 150 151 153 156 157 157 157 158 158 158 159 160 14 Populating Sample Data into Our Database 161 Downloading Adventure Works Data from Microsoft Attaching the Database Importing People from Adventure Works Synthesizing Help Desk Queues from Adventure Works Importing Tickets from Adventure Works Review the Results 161 162 166 168 172 174 15 Building the Help Desk Tabular Cube 177 Importing SQL Server Data into PowerPivot Connecting Excel to the PowerPivot Model Importing Data from the Windows Azure Marketplace DataMarket Summary 178 184 187 195 16 Enriching the Cube: Relationships and DAX 197 Relationships in PowerPivot vi | 197 Table of Contents www.it-ebooks.info Manually Adding Relationships Traversing Relationships with DAX Hiding Columns and Tables from Client Tools Using DAX to Aggregate Rows in a Related Table Calculating Earliest and Latest Related Dates with DAX Parsing Strings with DAX Counting and Aggregating Related Rows with DAX Count of Distinct Values with DAX Calculating the Difference Between Dates with DAX Adding a Measure from the Excel Side Counting Rows Across an Inactive Relationship Creating a Hierarchy for Dates Looking Up Related Data Without an Active Relationship Summary 200 201 203 205 207 208 210 213 214 217 218 224 228 231 17 Deploying to SharePoint 233 Sharing with Your Team Summary 233 239 18 SQL Server Analysis Services (SSAS) 241 Scalability Manageability Security Development Tools Direct Feature Comparison Upgrading a PowerPivot Workbook to a Tabular Model Validating the Deployment Automating Processing Your Cube Summary 241 242 242 243 244 245 253 253 262 Part IV 19 PivotTable Basics 265 Meaning from Data The Universal Business Intelligence Tool PivotTables Ranking Largest to Smallest Percentage of Parent Row Filtering and Sorting PivotTable Dimensions Visual Totals Values on Rows 265 265 266 267 268 269 270 274 Table of Contents www.it-ebooks.info | vii PivotCharts Summary 275 279 20 Slicers 281 Inserting an Additional PivotTable Connecting Additional PivotTables to Slicers Summary 283 287 289 21 Formatting 291 Custom Slicer Formatting Disabling Gridlines and Headings Formatting PivotTables and PivotCharts Summary 291 296 297 300 22 PivotTable Named Sets 301 Scenario: Last Four Years of Ticket Counts and Total Average Time to Closure 302 Reusing a Named Set for Another Chart 305 Summary 308 23 Sparklines and Data Bars 309 Sparklines: Intense, Simple, Word-Sized Graphics Adding a Data Bar Summary 309 317 318 24 Configuring a Gallery for Reporting Services, Power View, and Excel Services 319 Enabling Required Features Creating the PowerPivot Gallery Enabling Business Intelligence Content Types Setting Up Your Default View Summary 319 320 322 324 326 25 Reporting Services Basics 327 What Is Reporting Services? Report Architecture Creating a Reporting Services Data Source Launching Report Builder 3.0 Creating Datasets Creating a Reporting Services Report Adding a Chart Consuming an OData Feed from Reporting Services viii | Table of Contents www.it-ebooks.info 327 327 328 330 332 339 341 348 ...www.it-ebooks.info Developing Business Intelligence Apps for SharePoint David Feldman and Jason Himmelstein www.it-ebooks.info Developing Business Intelligence Apps for SharePoint by David Feldman... Introduction to Business Intelligence 139 What Is Business Intelligence? Applications of Business Intelligence Microsoft’s Tools for Business Intelligence. .. LightSwitch SharePoint Server 2010-2013 SharePoint Development: Past, Present, and Future Farm Solutions: SharePoint 2007 Sandbox Solutions and CSOM: SharePoint 2010 The Cloud App Model with Apps for SharePoint: