Archive

Archive for the ‘DAX’ Category

DAX-SUMMARIZE (ROLLUP)

January 11, 2012 1 comment

The following example adds roll-up rows to the Group-By columns of the SUMMARIZE function call.

EVALUATE SUMMARIZE( ‘Internet Sales’,
ROLLUP (‘Date'[Calendar Year],Product[Product Category Name]),
“Sales”, ([Internet Total Sales]),
“Tax”,([Internet Total Tax Amount]))

image

Red Box shows the sub-total of Categories further Brown Box shows Total of all Categories across all years.

Advertisement
Categories: BISM, DAX, SQL 12, Tabular Mode Tags: , ,

DAX – SUMMARIZE Statement

January 11, 2012 4 comments

 

SUMMARIZE function returns a summary table for the requested totals over a set of groups. Readers familiar with T-SQL SELECT statement, this is the equivalent of writing a query using the GROUP BY clause.

Syntax –

SUMMARIZE(<table>, <groupBy_columnName>[, <name>, <expression>]…)

Demo –

The Following example returns summary of the Internet Sales grouped around Country, Category & Calendar

EVALUATE SUMMARIZE( ‘Internet Sales’,
Geography[Country Region Name],
Product[Product Category Name],
‘Date'[Calendar Year],
“Internet Total Sales”,
‘Internet Sales'[Internet Total Sales])

Notice you do not need to define the relationships between tables when using SUMMARIZE because the relationship is defined in the model.

Output –

image

Currently I am getting expected output but output is not sorted for sorting I need to use another function – Order By

EVALUATE SUMMARIZE( ‘Internet Sales’,
Geography[Country Region Name],
Product[Product Category Name],
‘Date'[Calendar Year],
“Internet Total Sales”,
‘Internet Sales'[Internet Total Sales])
ORDER BY Geography[Country Region Name], Product[Product Category Name],’Date'[Calendar Year]


image

Further I can add measure to Order By –EVALUATE SUMMARIZE( ‘Internet Sales’,
Geography[Country Region Name],
Product[Product Category Name],
‘Date'[Calendar Year],
“Internet Total Sales”,
‘Internet Sales'[Internet Total Sales])
ORDER BY                                                                                                                                                                                         Geography[Country Region Name], Product[Product Category Name],’Date'[Calendar Year], ‘Internet Sales'[Internet Total Sales]

image

 

 

 

Categories: BISM, DAX, SQL 12, Tabular Mode Tags: , ,