DAX (Data Analysis Expressions)
In DAX (Data Analysis Expressions), calculations can be categorized into three types based on their aggregative behavior across different levels of a data model:
Additive Measures
These measures aggregate consistently across all levels of a dataset. They work well with standard aggregation functions like SUM, COUNT, or AVG.
Example: Total Sales
= SUM(Sales[Amount])
If you sum sales at the country level, region level, or individual transaction level, the total always remains consistent.
Works well with simple arithmetic operations (addition, multiplication).
Non-Additive Measures
These measures do not aggregate properly across different levels of a dataset. They usually involve calculations like DISTINCTCOUNT, MEDIAN, or PERCENTILE, which don’t sum up directly.
Example: Unique Customers
= DISTINCTCOUNT(Sales[CustomerID])
If a customer buys multiple times in different regions, counting them at a national level won’t be a simple sum of the regional counts.
Semi-Additive Measures
These measures aggregate correctly for some dimensions but not all. A common example is when values should be aggregated over some dimensions (like product categories) but not over time.
Example: Ending Inventory
= LASTNONBLANK(Sales[Date], SUM(Sales[Stock]))
Inventory counts are meaningful at a single date level but shouldn’t be summed over multiple dates.
Examples of semi-additive calculations:
LASTNONBLANK() (Last known value over time)
FIRSTNONBLANK() (First known value over time)
AVERAGEX() (Averages that depend on different granularities)
Comparison Summary
Would you like more real-world examples related to property management?