Presentación realizada en el Capítulo de Usuarios de SQL Server en Puerto Rico (PRPASS) en el mes de Octubre del 2012.
Presented during the monthly sessions of Puerto Rico PASS Chapter (www.prpass.org) - October, 2012.
1. Introduction to Data Analysis
Expressions (DAX)
Alan Koo
President & Founder | Puerto Rico PASS
Senior Consultant | Nagnoi, Inc.
2. Analysis Services 2012 Flavors
• Personal BI: PowerPivot for Excel 2010
• Team BI: PowerPivot for Sharepoint
• Corporate BI (SSDT):
– Analysis Services 2012 Tabular
– Analysis Services 2012 Multidimensional
Tasting the Flavors of SSAS 2012 | SQL Saturday Puerto Rico | Alan Koo | www.alankoo.com
3. What is DAX
• Programming language of SSAS 2012 Tabular and
PowerPivot
• Simple, clean, powerful, fast, not easy
• Tabular requires simpler data modeling for good result
• Thinking in DAX is a new attitude
4. BI Semantic Model: The Analysis Services 2012 Foundation
From Personal to Corporate BI
DAX MDX
Tasting the Flavors of SSAS 2012 | SQL Saturday Puerto Rico | Alan Koo | www.alankoo.com
8. Calculated Columns and Measures
• Calculated Columns
– Columns in the database, calculated with DAX
– Stored in the database
• Measures
– DAX formulas computed on aggregates of values
– Computed at query time
• Different usages for different modeling needs
9. Calculated Columns
• Formula is evaluated for each row
• Results are stored back into PowerPivot as any other
column
• Columns can be used for both slicing data and
summarizing values
• Part of the model, available for use in any PivotTable
• Usable by other AS clients in PowerPivot for SharePoint
10. DAX includes 80 Functions from Excel
Date and Time Information Math and Trig Statistical Text
DATE ISBLANK ABS AVERAGE CONCATENATE
DATEVALUE ISERROR CEILING, ISO.CEILING AVERAGEA EXACT
DAY ISLOGICAL EXP COUNT FIND
EDATE ISNONTEXT FACT COUNTA FIXED
EOMONTH ISNUMBER FLOOR COUNTBLANK LEFT
HOUR ISTEXT INT MAX LEN
MINUTE LN MAXA LOWER
MONTH Logical LOG MIN MID
NOW AND LOG10 MINA REPLACE
SECOND IF MOD REPT
TIME IFERROR MROUND RIGHT
TIMEVALUE NOT PI SEARCH
TODAY OR POWER SUBSTITUTE
WEEKDAY FALSE QUOTIENT TRIM
WEEKNUM TRUE RAND UPPER
YEAR RANDBETWEEN VALUE
YEARFRAC ROUND
ROUNDDOWN
ROUNDUP
SIGN
SQRT
SUM
SUMSQ
TRUNC 12
11. Calculated Measures
• Evaluated dynamically per value in PivotTable
• Part of the model, available to other PivotTables
• Usable by any AS client through PowerPivot for SharePoint
13
12. DAX Aggregation Functions
• SUM, AVERAGE, MIN, MAX, COUNT take column references
• Extensions aggregate an expression over the rows of a table
• SUMX (Table, Expression)
• AVERAGEX (Table, Expression)
• COUNTAX (Table, Expression)
• MINX (Table, Expression)
• MAXX (Table, Expression)
• COUNTROWS (Table)
14
16. Useful Resources
• Data Analysis Expressions (DAX) Overview – MSDN
http://msdn.microsoft.com/en-us/library/gg399181.aspx
• DAX in Action! – Alberto Ferrari in Project Botticelli
ProjectBotticelli.com
• SQLBI.com Articles
http://www.sqlbi.com/articles/all/
• Microsoft Business Intelligence y más… - Alan Koo
alankoo.com
17. Calculated Columns
• Calculated columns
– Stored in the database, computed at process time
– On big fact tables can consume a lot of RAM
– Required to slice data
• Measures
– Computed at query time, do not use RAM
• Prefer measures, whenever possible
18. Summary
• DAX is fast: its speed of DAX makes simpler modeling
techniques shine
• Tabular requires thinking in DAX, less modeling, more
complex expressions
• PowerPivot is a great prototyping tool, models created in
Excel can be deployed on SSAS Tabular
19. Credits for this Session
• Ashvini Sharma – Microsoft Corporation
• Alberto Ferrari and Marco Russo - SQLBI
21. Authorized Training Center
Designed for professionals who want to use PowerPivot’s full
capabilities, the PowerPivot Workshop is a two/three-day
course that covers PowerPivot topics, starting from basic
concepts and moving on up to complex data models and DAX
formulas with the goal to facilitate the use of PowerPivot in
the real world.
Nestor Figueroa | 787.671.8244
powerpivotworkshop@nagnoi.com
22. Puerto Rico PASS Chapter
Like us in Facebook! Our next meet is on Nov 29th.
Subscribe to our newsletter