Aggregation in DAX – How Aggregations Work? + Function Overview

Aggregate functions in DAX language are used to get certain summarized or grouped data view. Thanks to this, we can edit high detail data in a certain column into more simple and reportable form using aggregation. We can for example sum up (SUM, SUMX) some financial metrics by individual category or express maximal/minimal (MAX, MAXX, MIN, MINX) value using categories.

List of Aggregate Functions in DAX

Functions can be divided into 2 categories. There is a difference from Excel in DAX for Power BI and PowerPivot. Some functions in DAX have an equivalent function ending in “X“. These functions were explained in article SUM vs. SUMX.

1) Standard functions: <column> is the most accepted parameter. This does not count for COUNTROWS where the parameter is <table>. These functions perform aggregation always with the whole column.

  • SUM – sums up values in given column
  • COUNT – count of numeric values in given column
  • COUNTA – count of not-empty values in a column including text
  • MAX – returns maximal value in given column
  • MIN – returns minimal value in given column
  • AVERAGE – average of values in given column
  • AVERAGEA – works identically to function AVERAGE but it processes also non-numerical characters
  • COUNTBLANK – sums up all empty values in a column
  • COUNTROWS – number of rows in a table. It is mostly used in combination with function FILTER.

2) X Functions: These function accept table and expression <tabulka>, <expression> as a parameter. Then iterate row by row in given table. Their meaning is same to those mentioned above.

  • SUMX
  • MAXX
  • MINX
  • COUNTX
  • AVERAGEX
  • COUNTX

DAX Aggregation On An Example of Power BI Report

I will use my previously created Power BI laboratory again for this demonstration. I will be working with 2 tables – Sales (FactInternetSales) and Calendar (DimDate) – as in model.

Agregace datový model

I will then create metrics using standard aggregate functions and let it display in the report.

Aggregation functions in DAX for Power BI

 

Rate this post
Category: DAX

About Ing. Jan Zedníček - Data Engineer & Controlling

My name is Jan Zednicek, and I have been working as a freelance Data Engineer for roughly 10 years. During this time, I have been publishing case studies and technical guides on this website, targeting professionals, students, and enthusiasts interested in Data Engineering particularly on Microsoft technologies as well as corporate finance and reporting solutions. 🔥 If you found this article helpful, please share it or mention me on your website or Community forum

Leave a Reply

Your email address will not be published. Required fields are marked *