- Published on
Power BI DAX 101 - Aggregate
- Authors
- Name
- Emre Koc
- @58emrecan
Hello, today we will try to explain aggregate and iteration functions and its usage. At the beginning I would like to define a aggregate and iteration and also I leave here a further reading content.
Aggregate : it is a function in the DAX formula language. Aggregation functions calculate a (scalar) value such as count, sum, average, minimum, or maximum for all rows in a column or table as defined by the expression.
Iteration : Iterators in DAX are functions that iterate through all rows of the given table, apply the expression, and then aggregate the result. One of the known functions in this category is SUMX. because an iterator function goes through every row and apply the transformation, then the result is materialized (temporary) before aggregating it, and that causes the totals to be actual sum (or other aggregations) of values in a column.
Learn more Power BI at the Power BI,
Learn more Power BI at the Power BI
This is our dataset which name is Contoso Sales for Power BI and I add the dataset link here
We write our first DAX line adn it starts like,
SUM Sales = SUM(Sales[SalesAmount])
As you can see when you use SUM Dax functions it adds all numbers in the column. 8,3 mlr is our total sales number and it's fırst KPI.
We try to figure out our business minimum sales number with this line ;
Min Sales = MIN(Sales[SalesAmount])
Just 3,04 TL and I would like to convert TL to USD for you cause TL is a currency of Turkey. As of today (10.06.2022) 1 USD = 17.21 TL and 3.04 TL to 0.17 cent it's really low. And now we look for Max sales number with another aggregate function ;
Max Sales = MAX(Sales[SalesAmount])
This is our max sales number 235,47B And lastly we will use Average Dax Functions.
Average Sales = AVERAGE(Sales[SalesAmount])
It's end of the aggregate DAX function I hope next time we will be soon and we are going to learn Iteration DAX functions