Quantcast
Channel: SQLBI
Viewing all articles
Browse latest Browse all 434

Using SUMMARIZECOLUMNS instead of SUMMARIZE in #dax #powerbi #ssas #tabular

$
0
0

One of the latest addition to DAX has been the ability to apply an external filter context to SUMMARIZECOLUMNS, which makes this function a perfect replacement for SUMMARIZE in DAX. In The Definitive Guide to DAX I introduced such a function, but at the time of writing it was used only by Power BI and it wasn’t possible to include it in a measure, because of the limitation that now has been removed. Using SUMMARIZECOLUMNS you can write:

SUMMARIZECOLUMNS (
   
'Date'[CalendarYear], 
    'Product'[Color], 
    "Sales Amount", SUMX(Sales, Sales[Quantity] * Sales[Unit Price] )
)

instead of:

SUMMARIZE (
    Sales,
   
'Date'[CalendarYear], 
    'Product'[Color], 
    "Sales Amount", SUMX(Sales, Sales[Quantity] * Sales[Unit Price] )
)

A more complete description of this new function is available in the Introducing SUMMARIZECOLUMNS article I wrote on SQLBI.


Viewing all articles
Browse latest Browse all 434

Trending Articles