Strategy enhanced the Analytical Engine logic for OLAP cubes to correctly handle Count Distinct metrics for dynamic aggregation. The enhancement ensures that when a metric is defined to count distinct attribute values (for example, counting distinct Customer IDs), the engine generates a proper Count Distinct expression during dynamic aggregation. This fix targets metrics using Count Distinct on an attribute, with all metric components available in the cube at the time of publishing, so that dynamic aggregation yields accurate distinct count results.
Dynamic Null Function([[F_MAIN_INDEX].M01.CountDistinctAttr+Smart+AFB])@{[Category],[Region],[Year]}In this expression, the engine inserted a placeholder "Dynamic Null Function" at the level of Category, Region, and Year to avoid incorrect aggregation results. (AFB means Aggregate-From-Base for dynamic aggregation.)

count(distinct [Customer]@[CUSTOMER_ID])@{[Category]The engine generates a proper
Count Distinctdefinition on the attribute's ID (the component of the Count Distinct metric) at the specified level, that is, counting distinct Customer IDs by Category, Region, and Year.

In the Before scenario, the lack of a real aggregation function meant the metric did not compute a distinct count at all, leading to incorrect results such as as each row showing the raw attribute or null values. In the After scenario, the metric correctly calculates the number of unique attribute values within the grouping, even when all attributes are present on the report.
The incorrect behavior occurred because the Analytical Engine did not generate a proper aggregation function for the Count Distinct metric. Historically, certain aggregation functions (like distinct counts) are not dynamically aggregated by default because rolling them up on the fly can produce errors or double counting. In fact, the default dynamic aggregation function for metrics using Count Distinct was effectively none (set to no aggregation). Strategy documentation notes that metrics defined with functions such as Count Distinct are recalculated at higher levels using in-memory aggregation. They return null or placeholder values when dynamic aggregation is attempted.
The engine logic for Intelligent Cube metrics of the affected type was updated. The Analytical Engine now correctly handles Count Distinct aggregation for smart metrics when certain conditions are met. The enhancement applies to metrics that satisfy all of the following criteria:
When an OLAP cube metric meets all the criteria listed above, the engine's dynamic aggregation generates a true Count Distinct expression instead of a null function. To illustrate the improvement in formatting, the table below compares the dynamic aggregation formula before and after the engine update:
Before Enhancement After Enhancement | Before Enhancement After Enhancement |
Dynamic Null Function([...].CountDistinctAttr+Smart+AFB)@{[Category],[Region],[Year]}No distinct count applied, creating a null function | COUNT(DISTINCT [Attribute]@ID)@{[Category],[Region],[Year]} Proper distinct count applied at the Category, Region, and Year level |
In summary, the engine fix ensures that Count Distinct metrics in OLAP cubes using smart metrics with AFB behave as expected. The dynamic aggregation now properly calculates the distinct count of an attribute at any level of detail, yielding correct and consistent results even when the report includes all attributes. This enhancement allows users to confidently employ distinct count smart metrics in cubes without encountering the null or incorrect results from before.