Syntax
GROUPBY (<table>, [<groupBy_columnName1>], [<name>, <expression>]… )
Tutorial with example
In today’s DAX Fridays, we will go through the DAX function GROUPBY with an example.
GROUPBY is similar as SUMMARIZE, but the difference is that in the expression part, you use DAX iterators to get your results.
You can also nest GROUPBY functions to get for example the highest sales amount by country.

Links to the mentioned resources
To get the files:
1. Go to Curbal Download Center > Dax Fridays
2. Get File #77
Remarks
- The GROUPBY function does the following:
- Start with the specified table (and all related tables in the “to-one” direction).
- Create a grouping using all of the GroupBy columns (which are required to exist in the table from step #1.).
- Each group is one row in the result, but represents a set of rows in the original table.
- For each group, evaluate the extension columns being added. Unlike the SUMMARIZE function, an implied CALCULATE is not performed, and the group isn’t placed into the filter context.
Notes:
- Each column for which you define a name must have a corresponding expression; otherwise, an error is returned. The first argument, name, defines the name of the column in the results. The second argument, expression, defines the calculation performed to obtain the value for each row in that column.
- groupBy_columnName must be either in table or in a related table.
- Each name must be enclosed in double quotation marks.
- The function groups a selected set of rows into a set of summary rows by the values of one or more groupBy_columnName columns. One row is returned for each group.
Was this helpful?
Hi Ruth, a great summary thank you. I cannot see the download file on the download centre, can you direct me to it please?
Hi!
Unfortunately, if the file is not available there, it means that I lost it or deleted it , so I don’t have it anymore.
Sorry about that!
/Ruth