Professional Documents
Culture Documents
Dynamic formula
Results depend on the context
Standard Aggregation ~ Autosum feature, e.g. COUNT or SUM
Custom Formula, results based on context will not show in SSDT
DEMO
Calculated Columns and Calculated Measures
Context in DAX Formula
Ability to access all column values in the same table for the
current row
Ability to access all column values of related tables for the
current row
Multiple Rows
Some DAX functions can iterate value over a table
Inner and Outer Loop; Current Row values from the Inner Loop
is stored in memory
Row Context Example
=
[Freight] + RELATED ( 'Region'[TaxRate] )
---------------------------------------------------------
=
MAXX (
FILTER ( Sales, [ProdKey] = EARLIER ( [ProdKey] ) ),
Sales[OrderQty]
)
Query Context
=
SUM ( 'Sales'[Profit] )
Filter Context
RELATED
FILTER
ALL
ALLEXCEPT
EARLIER, EARLIEST
And many more:
http://msdn.microsoft.com/en-us/library/ee634807.aspx
Filter Context
Revenue CYTD :=
CALCULATE (
[Revenue],
FILTER (
ALL ( 'Date' ),
'Date'[Calendar Year] = MAX ( 'Date'[Calendar Year] )
&& 'Date'[Date] <= MAX ( 'Date'[Date] )
)
)
Introduction to DAX Patterns
Scenario:
Bank Transactions of accounts that may have more than one or
more account holders.
Many To Many - Classic
DEMO
DAX Pattern: Many to Many Classic
Option 1
NumOfCustomers:=COUNTROWS(Bridge_AccountCustomer)
AmountM2M:=
CALCULATE(SUM([Amount]),
FILTER(Bridge_AccountCustomer,
Bridge_AccountCustomer[NumOfCustomers]
>= 1))
Option 2
AmountM2M_CrossTable :=
CALCULATE(SUM([Amount]),
Bridge_AccountCustomer,
Dim_Account,
Dim_Customer)
Option 3
AmountM2M_SumX :=
SUMX(
FILTER(Fact_Transaction,
COUNTROWS(Bridge_AccountCustomer) > 0),
Fact_Transaction[Amount])
Resources
Value
Goal
Status
Session Takeaways
Show analytical requirements can be met by enriching Tabular
Model with
Calculated Columns
Measures
DAX Patterns
Show user experience can be enriched by:
Adding KPI
Setting Metadata
Configuring Actions
2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the
U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft
must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after
the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.