DAX Function Guide

Empty image or helper icon

Sam McKay

CEO & Founder

How does the GROUPBY work?
The GROUPBY function is similar to the SUMMARIZE function. However, GROUPBY does not do an implicit CALCULATE for any extension columns that it adds. GROUPBY permits a new function, CURRENTGROUP(), to be used inside aggregation functions in the extension columns that it adds. GROUPBY attempts to reuse the data that has been grouped making it highly performant.
GROUPBY Formula Syntax
GROUPBY (<table>, [<groupBy_columnName1>], [<name>, <expression>] … )
How do you use the GROUPBY?

The function GROUPBY does the following:

− Start with the specified table (and all related tables in the direction of “to-one”).

– Creates a grouping using all the GroupBy columns. In the result, each group is one row, but represents a set of rows in the original table.

– Evaluate the columns of extensions being added for each group.

Related Blog Posts


Considerations when using the GROUPBY?
  • Each column for which you define a name must have a corresponding expression. Otherwise, an error is returned.
    • The first parameter, name, defines the name of the column in the results. The second parameter, expression, defines the calculation performed to obtain the value for each row in that column.
    • Each name must be enclosed in double quotation marks.
  • groupBy_columnName must be either in a table or in a related table.
    • 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.
Related Video Tutorials


Formula examples using the GROUPBY
“Total Sales”, SUMX( CURRENTGROUP(), Sales[Price] * Sales[Qty])
Related Courses