top of page
Search
Writer's picturePowerBI Zone

SUMMARIZE Dax in Power BI

Updated: Jul 27, 2022

Usage of SUMMARIZE Dax : Returns a summary table for the requested totals over a set of groups

Syntax of SUMMARIZE Dax : SUMMARIZE (<table>, <groupBy_columnName>[, <groupBy_columnName>]…[, <name>, <expression>]…)

Parameters Used:

TermDefinitiontableAny DAX expression that returns a tablegroupBy_ColumnName(Optional) The name of an existing column used to create summary groups based on the values found in it. This parameter cannot be an expression.nameThe name given to a total /summarize columnexpressionAny DAX expression that returns a single scalar value, where the expression is to be evaluated multiple times (for each row/context).SUMMARIZE Dax Parameter Explained

Summarize can be used in the following ways :

1.Return distinct list of values as shown in the below code:

Distinct Countries = 
SUMMARIZE(financials,
                  financials[Country]
         ) 

2.Return a summary table containing aggregated values as shown below:

Sales/Profit per Country per Yr = 
SUMMARIZE(financials,
        financials[Country],
        financials[Year],
        "Sales",sum(financials[ Sales]),
        "Profit",sum(financials[Profit]))

3.We can use summarize inside a measure as shown below.

Measure-MAX_Sales/Profit per Country per Yr = 

Var a1=
        SUMMARIZE(
            financials,
            financials[Country],
            financials[Year],
            "Sales3",MAX(financials[ Sales])
            )
            

var b=sumx(a1,[Sales3])
return b

For more details please watch below video on Summarize Dax

Differences between Summarize and SummarizeColumns

Now let us see what is the difference between Summarize and SummarizeColumns?

As you had seen above Summarize merely summarizes a table without filtering .SummerizeColumn can add filtering capability to Summarize as shown below in the syntax:

Syntax of SummarizeColumns :

SUMMARIZECOLUMNS( <groupBy_columnName> [, < groupBy_columnName >]…, [<filterTable>]…[, <name>, <expression>]…)

Parameters

TermDefinitiongroupBy_columnNameA column reference (Table[Column]) to a base table for which the distinct values are included in the returned table. filterTableA table expression which is added to the filter context of all columns specified as groupBy_columnName arguments. nameThe name for the subsequent expression specified.expressionAny DAX expression that returns a single valueParameters of SUMMARIZECOLUMNS

Return value

A table which includes combinations of values from the supplied columns based on the grouping .

Remarks on differences between Summarize and SummarizeColumns :

When creating a table try using SummarizeColumns instead of Summarize .Remember SummarizeColumns is quicker .

When creating a measure try using Summarize since Summarize column will not work in Context transition (in Tables, Matrix ,Charts) .It only works in cards.

Do watch the below video for more clarification.



8 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page