Power BI DAX: SUMMARIZE Multiple Columns

YearlySalesByRegion = 
SUMMARIZE(
Sales,
'Date'[Year],
Sales[Region],
"Total Sales", SUM(Sales[Sale])
)

The SUMMARIZE function in DAX is a versatile tool for creating summary tables by grouping data based on multiple columns. This function allows users to aggregate data efficiently, providing insights into various combinations of categories.

Example Scenario

Imagine you have the following data tables:

Date Table

DateMonthYear
2024-01-01January2024
2024-02-01February2024
2024-03-01March2024
2023-01-01January2023
2023-02-01February2023
2023-03-01March2023

Sales Table

DateSaleRegion
2024-01-011000.00North
2024-02-011500.00South
2024-03-012000.00North
2023-01-011200.00South
2023-02-011300.00North
2023-03-011400.00South

DAX Calculation To create a calculated table that includes a row for each combination of Year and Region, and a column with the total sales for each combination, you can use the following DAX expression:

YearlySalesByRegion = SUMMARIZE( Sales, 'Date'[Year], Sales[Region], "Total Sales", SUM(Sales[Sale]) )

How It Works

• Grouping by Year and Region: The SUMMARIZE function groups the data by the Year column from the Date table and the Region column from the Sales table.

• Calculating Total Sales: For each group, it calculates the total sales using the SUM function on the Sale column from the Sales table.

• Creating the Summary Table: The result is a new table with a row for each combination of Year and Region, and a column named "Total Sales" that contains the sum of sales for each combination.

Resulting Table

YearRegionTotal Sales
2024North3000.00
2024South1500.00
2023North1300.00
2023South2600.00

This calculated table dynamically generates rows for each combination of Year and Region present in your data and calculates the total sales for each combination.

Conclusion

In this discussion, we explore how to use the SUMMARIZE function to group sales data by both year and region, demonstrating its capability to generate comprehensive summary tables that facilitate deeper data analysis. By understanding and applying this function, users can enhance their data modeling and reporting in Power BI.