Aggregation in DAX – How Aggregations Work? + Function Overview

Last modified date:

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

 

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Category: DAX Tags: ,

About Ing. Jan Zedníček - BI Developer, Finance controller

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.