Home > BISM, DAX, SQL 12, Tabular Mode > DAX – SUMMARIZE Statement

DAX – SUMMARIZE Statement

 

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

 

 

 

Advertisements
Categories: BISM, DAX, SQL 12, Tabular Mode Tags: , ,
  1. bkr
    January 26, 2012 at 12:28 pm

    http://5000lenenbkr.nl Thanks for that awesome posting. It saved MUCH time 🙂

  2. January 29, 2012 at 11:13 pm

    cover letters Hey there, I simply enjoy your web-site. Very much usefull information and facts. Appreciate it for sharing it with us. Regards!

  3. February 7, 2012 at 8:22 am

    I drop a comment when I appreciate a article on a site or I have something to add to the conversation. It is caused by the sincerness communicated in the article I looked at. And on this post DAX – SUMMARIZE Statement Karan Gulati | Microsoft BI. I was excited enough to drop a comment 🙂 I actually do have a couple of questions for you if you don’t mind. Is it only me or do a few of the comments appear as if they are coming from brain dead visitors? 😛 And, if you are writing at additional places, I’d like to keep up with you. Could you make a list the complete urls of all your social pages like your linkedin profile, Facebook page or twitter feed?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: