SUMMARIZECOLUMNS, SUMMARIZE and ADDCOLUMNS in DAX

How to group and summarise tables in DAX, SUMMARIZECOLUMNS for queries and measures, SUMMARIZE for grouping, ADDCOLUMNS for adding calculated columns, GROUPBY with CURRENTGROUP, subtotals with ROLLUPADDISSUBTOTAL, IGNORE and NONVISUAL, and which to use when.

Short answer: SUMMARIZECOLUMNS ( group columns, filters, "Name", expression ) is the grouping function Power BI itself uses for visuals: it groups by columns from any tables, applies filters, adds measures, and drops rows where all measures are blank. Use it in queries and, where supported, in measures. SUMMARIZE ( table, columns ) groups the rows of one table by its columns and related ones; use it only for grouping, and add calculations with ADDCOLUMNS, which adds expression columns to any table. GROUPBY with CURRENTGROUP aggregates rows of a table variable.

Grouping is behind "top customers", "months above target", "average per store" and every DAX query. The four functions overlap, and picking the right one avoids slow and wrong results.

What does each do?

FunctionGroups byAddsTypical use
SUMMARIZECOLUMNScolumns of any tablesmeasures, with filtersDAX queries, visual-like tables
SUMMARIZEcolumns of one table and related ones(avoid adding here)distinct combinations
ADDCOLUMNSnothing: keeps the rows givenexpression columnsadd measures to a grouped table
GROUPBYcolumns of a table or variableaggregations over CURRENTGROUPgrouping a table variable
Grouping functions

How do you use SUMMARIZECOLUMNS?

EVALUATE
SUMMARIZECOLUMNS (
    'Date'[Year],
    'Product'[Category],
    TREATAS ( { "Online" }, Sales[Channel] ),
    "Revenue", [Revenue],
    "Customers", [Customers]
)
YearCategoryRevenueCustomers
2025Bikes1,840,0003,120
2025Accessories390,0005,400
2026Bikes2,100,0003,450
2026Accessories420,0005,980
Result

Group columns can come from different tables (Year from Date, Category from Product); combinations with no data for every measure are dropped, like in a visual. The result has no guaranteed order; add ORDER BY in a query.

Options inside it:

  • IGNORE ( expression ): the expression does not count when deciding which rows are blank.
  • NONVISUAL ( filter ): the filter limits the group rows but not the measure values.
  • ROLLUPADDISSUBTOTAL ( column, "IsSubtotal" ): adds subtotal rows and a flag column.

How do SUMMARIZE and ADDCOLUMNS work together?

-- distinct customer and city pairs that have sales
Customer Cities = SUMMARIZE ( Sales, Customer[Customer], Customer[City] )

-- add measures to them
Customer Table =
ADDCOLUMNS (
    SUMMARIZE ( Sales, Customer[Customer], Customer[City] ),
    "Revenue", [Revenue],
    "Orders", [Orders]
)

-- use it in a measure: customers whose average order is over 500
Big Basket Customers =
COUNTROWS (
    FILTER (
        ADDCOLUMNS ( VALUES ( Customer[Customer] ), "@AOV", DIVIDE ( [Revenue], [Orders] ) ),
        [@AOV] > 500
    )
)

SUMMARIZE can also add expression columns, but the common advice is ADDCOLUMNS ( SUMMARIZE ( ... ) ): expressions calculated inside SUMMARIZE can see unexpected filter contexts, while ADDCOLUMNS evaluates each row with a clear context transition. Prefix helper column names with @ so they are not mistaken for measures.

When is GROUPBY useful?

GROUPBY aggregates rows inside each group with the X functions over CURRENTGROUP ( ), and it works on table variables. Here it finds each year's best month, then averages those best months:

Avg of Yearly Best Months =
VAR Months =
    ADDCOLUMNS (
        SUMMARIZE ( Sales, 'Date'[Year], 'Date'[Month] ),
        "@Rev", [Revenue]
    )
RETURN
    AVERAGEX (
        GROUPBY ( Months, 'Date'[Year], "@Best", MAXX ( CURRENTGROUP ( ), [@Rev] ) ),
        [@Best]
    )

What goes wrong?

  • Expressions inside SUMMARIZE. Use ADDCOLUMNS around it.
  • SUMMARIZECOLUMNS in calculated columns or RLS in DirectQuery. Not supported.
  • Expecting order. Neither function sorts; sort in the query or the visual.
  • Blank rows. SUMMARIZECOLUMNS drops rows where every measure is blank; ADDCOLUMNS ( VALUES ( ... ) ) keeps them.
  • Too fine a grain. Grouping by date and customer on a large model produces millions of rows; group at the level you need.

Where can you check this?

Where do you start?

Write one SUMMARIZECOLUMNS query in DAX query view that matches a table on your report, and compare the numbers. TOPN keeps only the first rows of such a table.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.