DAX Aggregation Functions
Examples of aggregation functions within Microsoft Power BI.
A. SUMX:
Total Sales = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])
This example calculates the sum of the product of Quantity and UnitPrice for each row in the Sales table, providing the total sales amount.
B. AVERAGEX:
Average Revenue = AVERAGEX(Orders, Orders[Revenue])
This example calculates the average revenue by dividing the sum of the Revenue column in the Orders table by the number of rows in the table.
C. MINX:
Minimum Sales = MINX(Sales, Sales[SalesAmount])
This example returns the minimum value from the SalesAmount column in the Sales table.
D. MAXX:
Maximum Profit = MAXX(Profit, Profit[Amount])
This example returns the maximum value from the Amount column in the Profit table.
E. COUNTX:
Total Customers = COUNTX(Customer, Customer[CustomerID])
This example counts the number of rows in the Customer table, providing the total number of customers.
F. DISTINCTCOUNT:
Unique Products = DISTINCTCOUNT(Products[ProductID])
This example counts the number of distinct ProductID values in the Products table, giving the total number of unique products.
502