This article is about the GROUPBY function. It creates groups or subtotals in DAX (works similarly to Pivot Tables).

We will use this table with cars, that can be grouped by various columns.

Simple grouping 

Let´s group the table by Brands ( = create a list of brands).

Create a new calculated table and define it by this command:

  • List of brands = GROUPBY(

The syntax contains:

  • Name of table
  • Name of column used for grouping.

Grouping by multiple columns

But what if you needed to group the table not only by Brand, but also by Models?

You can add new argument referencing the other column:

  • List of brands and models = GROUPBY(

Now the syntax contains:

  • Name of table
  • All columns used for grouping.

Grouping with calculations

Off course, we can add some sums, counts or something like this. In this example I´d like to see the sums and counts:

  • List of brands and models and prices = GROUPBY(
       “Total price”,
          cars[ Price ]))

Now the syntax contains:

  • Name of table
  • All columns used for grouping
  • Name of first calculated column
  • Calculation, using such functions as COUNTX, SUMX… combined with CURRENTGROUP
  • Name and calculation for other column etc.

Two additional notes


  1. Hi. Good Article. I’d like to group by a table like that. But I need to be able to filter the information after group by per date. Is there any way to do that?

  2. Is there a way to group by price range?
    Range #Cars
    $0 – $19,999
    $20,000 – $29,999
    $30,000 – $49,999
    $50,000 +

  3. Charles, after groupby table created, then develop measures to price ranges.

Leave a Reply

Your email address will not be published.


clear formPost comment