Book Image

Microsoft Power BI Cookbook

By : Author Test, Brett Powell
Book Image

Microsoft Power BI Cookbook

By: Author Test, Brett Powell

Overview of this book

Microsoft Power BI is a business intelligence and analytics platform consisting of applications and services designed to provide coherent, visual and interactive insights of data. This book will provide thorough, technical examples of using all primary Power BI tools and features as well as demonstrate high impact end-to-end solutions that leverage and integrate these technologies and services. Get familiar with Power BI development tools and services, go deep into the data connectivity and transformation, modeling, visualization and analytical capabilities of Power BI, and see Power BI’s functional programming languages of DAX and M come alive to deliver powerful solutions to address common, challenging scenarios in business intelligence. This book will excite and empower you to get more out of Power BI via detailed recipes, advanced design and development tips, and guidance on enhancing existing Power BI projects.
Table of Contents (14 chapters)

Installing and Configuring DAX Studio

DAX (Data Analysis Expressions) is the "language of Power BI" as it's used to create the measures and queries visualized in Power BI reports and dashboards. Power BI generates and submits DAX queries to the source data model based on the structure of the visualization, user selections, and filters, just as other tools such as Excel generate MDX queries based on the selections and structure of pivot tables and slicers from workbooks. DAX expressions are also used to define security roles and can optionally be used to create columns and tables in data models based on other tables and columns in the model, which can be refreshed at processing time and used by measures and queries. Given that DAX serves the same function in SQL Server Analysis Services (SSAS) Tabular models and Power Pivot for Excel models, it's essential that BI professionals have a robust tool for developing and analyzing DAX code and the data models containing these expressions.

DAX Studio is a third-party tool used to query data models, edit and format code, browse the structure and metadata of data models, and analyze the performance and execution characteristics of DAX queries. For larger and more complex data models and expressions, as well as projects involving multiple models, DAX Studio becomes an essential supplement to the development and performance tuning processes.

How to do it...

Installation of DAX Studio

  1. Download the latest version from CodePlex (https://daxstudio.codeplex.com/).
CodePlex is in the process of shutting down and thus DAX Studio may be available on GitHub or another open source project repository in the future. The CodePlex archive may provide guidance to the new home for DAX Studio and the SQLBI.com blog's link to DAX Studio will likely be updated to the latest version as well.
  1. Save the .exe application file to your local PC.

  1. A notification is displayed as new versions are available.
Figure 27: Downloaded Setup Application from CodePlex
  1. Initiate the installation and setup Process.
  2. Accept the license agreement and choose a folder path to install the tool.
  3. Choose whether the DAX Studio add-in for Excel will also be installed.
    • The Add-In for Excel is required to connect to Power Pivot for Excel data models
    • Additionally, when DAX Studio is opened from Excel, query results can be exported directly to Excel tables
Figure 28: DAX Studio Setup
  • Upon full installation including the Add-in for Excel, a DAX Studio icon will appear on the Add-Ins Tab in the Excel Ribbon; the DAX Studio Add-in can be deactivated via the manage COM Add-ins dialog available from Excel--Options | Add-Ins tab.

Figure 29: DAX Studio Windows Application

Figure 30: The DAX Studio Add-in for Excel

The full installation with the Excel add-in is recommended as this enables direct output of DAX query results to Excel workbook tables and is required for connecting to Power Pivot data models.

Configuration of DAX Studio

  1. Open an Excel workbook.
  2. Open a Power BI Desktop file.
  3. From the Add-Ins tab of the toolbar, activate DAX Studio.
Figure 31: The DAX Studio Add-in for the Excel Connect Dialog
  1. Close the Excel workbook.
  2. Launch the DAX Studio standalone Windows application.
  3. Connect to a Power BI Desktop file or SSAS Tabular instance.

The Advanced Options settings of the Connect dialog establishes a connection in the context of the Sales Territory-North America security role defined in the model.

Figure 32: Advanced connect options
  1. Enable the DirectQuery Trace setting from the Options menu (File | Options).
  2. This provides visibility to the SQL queries passed from DirectQuery models.
Figure 33: DirectQuery trace enabled

How it works...

  • The standalone application provides the same functionality as the Excel add-in, excluding connectivity to Power Pivot for Excel data models and Excel output options
  • Powerful configuration options include the ability to specify a security role, effective user name identity, and Locale when defining connections to data models and when analyzing trace events associated with DirectQuery data models (that is, the SQL statements generated and passed to sources)
  • With DirectQuery Trace enabled, a connection to a DirectQuery model will expose the SQL statements passed to the source system in the Server Timings window

Figure 34: DAX Studio Trace of a DirectQuery Model

There's more...

Guy in a Cube video channel

An additional resource for learning and deploying Power BI is Adam Saxton's Guy in a Cube video channel (http://bit.ly/2o2lRqU). These videos, currently released every Tuesday and Thursday, feature concise, hands-on reviews and resolutions to common issues and scenarios. They also have high-level summaries of recent Power BI updates and releases. As a member of the MSBI content team, Adam can incorporate specific guidance from Microsoft product and technical teams, and regularly identifies recent blog posts from the wider Power BI community.