Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Saturday New York City May 19th, 2018

Similar presentations


Presentation on theme: "SQL Saturday New York City May 19th, 2018"— Presentation transcript:

1 SQL Saturday New York City May 19th, 2018
DAX Query Use Cases Brett Powell BI Consultant, Author

2 What is a DAX Query? DAX Measures DAX Queries
Scalar values DAX Queries Table values EVALUATE clause Table parameter to measure DAX Query Authoring Tools SQL Server Management Studio DAX Studio DAX Measures in Power BI DAX Queries in SSMS

3 Leverage DAX Queries Across Tools & Scenarios
User: custom table for their tool of choice or need Scenario: custom table for individual report(s) or isolated use case Store and reuse queries across data models (e.g. Dev/Prod) Report Projects in Visual Studio Reports in Report Builder BI Dev Tables in Excel Reports Power BI Report Power User Data Model Analysis Services Database *Power BI Dataset (Premium) SQL Server Management Studio DAX Studio BI Admin & Dev

4 Use Cases for DAX Queries
Paginated Reports in Power BI Report Server or SQL Server Reporting Services (SSRS) Drillthrough Expressions in Analysis Services Detail Rows in Analysis Services 2017+ Performance Tuning Capture and analyze queries from Power BI Test performance of DAX measures Embed Queries (Tables) in DAX Measures Query or queries drive measure results Data Model Tables (Import Mode) Analysis Services or Power BI Excel Data Tables Query local or external data model Custom Application DAX queries against Analysis Services Data Model Troubleshooting Missing rows, missing values Calculated Tables in Power BI and Analysis Services and more….

5 Introductory Examples

6 Use Case: Excel Table via Custom ODC
Analyze in Excel or Power BI Publisher for Excel Obtain ODC (Office Data Connection) to source model Embed DAX Query in ODC File Optionally embed multiple queries in Excel 1. Custom ODC 3. New Query in Excel 2. Retrieve Query as Table

7 Use Case: Ad Hoc Analysis; Troubleshooting
How many rows per table? What’s the distribution of rows by date? Any missing rows or values? Find the details of any exceptions? Row Counts Rows with Blank Values Row Counts in SSMS

8 Use Case: Import Analysis Services to PBI Desktop
Single Table Simplified self-service reporting via aggregated and filtered table Pass DAX query from Power BI Desktop Self-Service Model Merge Analysis Services data with other data source DAX and M (Power Query) queries Support limited self-service (sandbox) Parameterized DAX query Table in Power BI Desktop Query Dependencies in Power BI Desktop

9 DAX Query Structure and Functions

10 Common DAX Table Functions
CALCULATETABLE SUMMARIZECOLUMNS FILTER VAR ALL INTERSECT VALUES EXCEPT DATATABLE UNION ADDCOLUMNS DISTINCT TOPN NATURALINNERJOIN SELECTCOLUMNS SUMMARIZE CROSSJOIN GENERATE Table SUMMARIZECOLUMNS FILTER CALCULATETABLE

11 DAX Query Structure and Examples
DEFINE (Optional) Measures or Variables EVALUATE (Required) Table or Table Expression ORDER BY (Optional) START AT (Optional) Full DAX Query Syntax DAX Query Results: SQL Server Management Studio (SSMS)

12 DAX Query Examples Select Columns Filter Conditions Grouping Columns
Relationships implied Filter Conditions CALCULATETABLE FILTER, TOPN Grouping Columns SUMMARIZECOLUMNS() SUMMARIZE() Aggregations Use measures of model Optionally create measures for query DAX Query Example DAX Query Results: SQL Server Management Studio (SSMS)

13 DAX Queries in Power BI Report Server Reports

14 Report Project in SQL Server Data Tools (SSDT)
Paginated Reports Why paginated reports? Printer-friendly, multi-page reports Leverage SSRS experience and reports Migrate source of reports to Analysis Services Mature, robust report design features Development Tools: Report Builder SQL Server Data Tools (SSDT) Paginated Report Report Project in SQL Server Data Tools (SSDT)

15 Paginated Report Examples
Internet Sales Analysis Standard paginated report (.RDL) First Year Customer Report Pages of customer details Printer-friendly Reseller Analysis Reseller Details linked report Drillthrough action via parameter Internet Sales User Analysis Parameters for interactive filtering Single and multi-value parameters Paginated Report Linked Paginated Report

16 Embedding DAX Queries in Measures

17 DAX Queries in Measures Examples
Filter measure by table FILTER and CALCULATETABLE Multi-table OR conditions CROSSJOIN SUMMARIZE Multiple Sets of Customers UNION NATURALINNERJOIN Multiple Sets and Filters FILTER, SUMMARIZE, and CALCULATETABLE

18 Thank You

19 Contact Information Brett Powell LinkedIn Blog: Insight Quest Amazon: Author Page


Download ppt "SQL Saturday New York City May 19th, 2018"

Similar presentations


Ads by Google