Download presentation
Presentation is loading. Please wait.
Published byPrudence Moody Modified over 8 years ago
1
Write DAX Queries using DAX Studio Alex Barbeau alex.barbeau@gnetgroup.com
2
Let’s get started 10/10/2015Write DAX Queries using DAX Studio2 | Thank you Sponsors! o Please visit the sponsors during the vendor break from 2:45 – 3:15 and enter their end-of-day raffles Event After Party o Dave and Buster’s in Southdale Center. 3 rd floor by Macy’s starting at 6:15 Want More Free Training? o PassMN meets the 3 rd Tuesday of every month. https://mnssug.org/ https://mnssug.org/
3
Agenda Why Query with DAX? DAX Studio Demos! Questions? 3 |10/10/2015Write DAX Queries using DAX Studio3 |
4
DAX is a Query Language?? Indeed it is! Measures are just one (very important) piece It’s tables all the way down Vectors and Matrices are a good theoretical start A query returns a table Queries are natively ‘Grouped By’ 4 |10/10/2015Write DAX Queries using DAX Studio4 |
5
Why Query Power BI/Tabular You need a data source for: Datazen SSRS SQL Server Reporting Services External Reporting Tool Your own self-service BI from existing models Need to extract data from Power BI Desktop DAX Development Great way expand understanding of DAX 5 |10/10/2015Write DAX Queries using DAX Studio5 |
6
Note on Terminology By Tabular I am referring to the framework behind the following software: SSAS Tabular 2012-2016 Power Pivot in Excel 2010-2016 Power BI Desktop Query structure is the same in all Queries will use standard ‘Table’[Column] references and [Measure] references 6 |10/10/2015Write DAX Queries using DAX Studio6 |
7
Please ask Questions Odds are others have similar questions A full response may be delayed till a later slide Some queries may be deliberately poorly written to demonstrate concepts and syntax Basic familiarity with DAX assumed here-on Columnar storage CALCULATE(), VALUES(), FILTER() 7 |10/10/2015Write DAX Queries using DAX Studio7 |
8
DAX Development Write queries and develop measures against a new or existing model Power Pivot Visual Studio SSMS SQL Server Management Studio Excel (2013+) Edit DAX from a table Bit of an involved process DAX Studio 8 |10/10/2015Write DAX Queries using DAX Studio8 |
9
DAX Studio It Queries! It Formats! It Traces! 9 |10/10/2015Write DAX Queries using DAX Studio9 |
10
DAX Studio Open Source tool for querying Tabular models http://daxstudio.codeplex.com/ http://daxstudio.codeplex.com/ Developed (principally) by Darren Gosbell Marco Russo Query Excel, Tabular, and Power BI Desktop Let the team know what you think! 10 |10/10/2015Write DAX Queries using DAX Studio10 |
11
Today’s Model 11 |10/10/2015Write DAX Queries using DAX Studio11 | Adventure Works Internet Sales
12
EVALUATE Think of this like SELECT Does nothing without an expression to Wait for it EVALUATE 12 |10/10/2015Write DAX Queries using DAX Studio12 |
13
ROW() Return a row of values ROW(, [,,,…]) is any “text within quotes” is any DAX expression that returns a scalar 13 |10/10/2015Write DAX Queries using DAX Studio13 |
14
SUMMARIZE() Build tables as you need them SUMMARIZE(, [, ]…[,, ]…) Any DAX expression that returns a table A table reference counts Any column in any table A column in a related table is a good start , Just like ROW(), but now for the context defined above 14 |10/10/2015Write DAX Queries using DAX Studio14 |
15
ADDCOLUMNS() Add values to a given table ADDCOLUMNS(,, [,, ]…) Any DAX expression that returns a table Same as in ROW() Any DAX expression that returns a scalar for a given row in the SUMMARIZE() returns a table… 15 |10/10/2015Write DAX Queries using DAX Studio15 |
16
Best Practice Sidebar Best Practice to wrap ADDCOLUMNS() around SUMMARIZE() Reduces unnecessary calculations Finer control over what is returned Generally faster Model dependent of course Exception is ROLLUP() commands, out of scope for this session 16 |10/10/2015Write DAX Queries using DAX Studio16 |
17
CALCULATETABLE() Efficient (generally) way to filter a query CALCULATETABLE(,,,…) A DAX expression that returns a table Boolean expression or a table expression that defines a filter 17 |10/10/2015Write DAX Queries using DAX Studio17 |
18
DEFINE MEASURE Re-usable measures just for your query DEFINE MEASURE [ ] = An existing table in the data model Same as prior slides A DAX expression that returns a scalar 18 |10/10/2015Write DAX Queries using DAX Studio18 |
19
SUMX() Turning your query into a measure SUMX(, ) An existing table in the data model Same as prior slides A DAX expression that returns a scalar 19 |10/10/2015Write DAX Queries using DAX Studio19 |
20
Resources DAX Studio http://daxstudio.codeplex.com/ http://daxstudio.codeplex.com/ SQLBI.com Marco and Alberto wrote the book(s) on DAX DAX function Reference https://msdn.microsoft.com/en-us/ee634396 https://msdn.microsoft.com/en-us/ee634396 Community MSDN Forums https://social.msdn.microsoft.com/Forums/sqlserver/en- US/home?forum=sqlkjpowerpivotforexcel https://social.msdn.microsoft.com/Forums/sqlserver/en- US/home?forum=sqlkjpowerpivotforexcel Model https://awinternetsalestabularmodel.codeplex.com/ https://awinternetsalestabularmodel.codeplex.com/ 20 |10/10/2015Write DAX Queries using DAX Studio20 |
21
Questions? Comments? Points of Rebuttal? 21 |10/10/2015Write DAX Queries using DAX Studio21 |
22
SQL Saturday Evaluations 10/10/2015Write DAX Queries using DAX Studio22 | Remember to fill out your online evaluations for the event and any sessions you have attended. They will be online until 10/17/15. http://www.sqlsaturday.com/453/eventeval.aspx http://www.sqlsaturday.com/453/sessions/sessione valuation.aspx
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.