DAX Other - GROUPBY function

Returns a table with a set of selected columns. Permits DAX CURRENTGROUP function 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.
DAX GROUPBY function is similar to DAX SUMMARIZE function. However, GROUPBY does not do an implicit CALCULATE for any extension columns that it adds.
DAX GROUPBY function is new in Excel 2016.
GROUPBY (<table>, [<groupBy_columnName1>], [<name>, <expression>] ...) 

table
Any DAX expression that returns a table of data.
groupBy_columnName1
The name of an existing column in the table (or in a related table), by which the data is to be grouped.
This parameter cannot be an expression.
name
The name given to a new column that is being added to the list of GroupBy columns, enclosed in double quotes.
expression
Any DAX expression that returns a single scalar value, where the expression is to be evaluated for each set of GroupBy values.
It can include any of the “X” aggregation functions, such as SUMX, AVERAGEX, MINX, MAXX, etc. and when one of these functions is used in this way, the table parameter (which is a table expression) can be replaced by CURRENTGROUP function. (Refer Remarks Section for details).
It can include any of the “X” aggregation functions, such as SUMX, AVERAGEX, MINX, MAXX, etc. and when one of these functions is used in this way, the table parameter (which is a table expression) can be replaced by CURRENTGROUP function. (Refer Remarks Section for details).
However, CURRENTGROUP function can only be used at the top level of table scans in the expression. That means,

ABS (SUMX (CURRENTGROUP (), [Column])) is allowed, since ABS does not perform a scan.
But, SUMX (<table>, SUMX (CURRENTGROUP () ...)) is not allowed.


However, CURRENTGROUP function can only be used at the top level of table scans in the expression. That means,
ABS (SUMX (CURRENTGROUP (), [Column])) is allowed, since ABS does not perform a scan.
ABS (SUMX (CURRENTGROUP (), [Column])) is allowed, since ABS does not perform a scan.
But, SUMX (<table>, SUMX (CURRENTGROUP () ...)) is not allowed.
But, SUMX (<table>, SUMX (CURRENTGROUP () ...)) is not allowed.
DAX CALCULATE function and calculated fields are not allowed in the expression
DAX CALCULATE function and calculated fields are not allowed in the expression
A table with the selected columns for the groupBy_columnName parameters and the grouped by columns designated by the name parameters.
The GROUPBY function does the following −
Start with the specified table (and all related tables in the “to-one” direction).
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).
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.
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 is not placed into the filter context.
For each group, evaluate the extension columns being added. Unlike the SUMMARIZE function, an implied CALCULATE is not performed, and the group is not placed into the filter context.
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.


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.
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.
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.


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.
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.
CURRENTGROUP function can only be used in an expression that defines a column within the GROUPBY function.
CURRENTGROUP function can only be used in an expression that defines a column within the GROUPBY function.
CURRENTGROUP returns a set of rows from the table parameter of GROUPBY that belong to the current row of the GROUPBY result.
CURRENTGROUP returns a set of rows from the table parameter of GROUPBY that belong to the current row of the GROUPBY result.
CURRENTGROUP function takes no parameters and is only supported as the first parameter to one of the following aggregation functions: AverageX, CountAX, CountX, GeoMeanX, MaxX, MinX, ProductX, StDevX.S, StDevX.P, SumX, VarX.S, VarX.P.
CURRENTGROUP function takes no parameters and is only supported as the first parameter to one of the following aggregation functions: AverageX, CountAX, CountX, GeoMeanX, MaxX, MinX, ProductX, StDevX.S, StDevX.P, SumX, VarX.S, VarX.P.
= GROUPBY ( 
   Sales,Sales[Salesperson],Products[Product],"Total Sales",  
   SUMX (CURRENTGROUP (),[Sales Amount]) 
)

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page