Written by

Developer, analyst, qa, moderator at TECCOD
Question Dmitrij Vladimirov · May 28

AGGREGATE in MDX

Hi community.

How do i count distinct values over cumulative date dimension?

I got calculated measure function defined in cube: COUNT([dimension].[H1].[dimension].Members, EXCLUDEEMPTY)

[dimension].[H1].[dimension] = non-unique numerical fields of ids

Then i got AGGREGATION function defined in Analyzer (that stored in ^DeepSee.CalcMbrs):

AGGREGATE(%TIMERANGE(TimeDimension.hierarchy.level,TimeDimension.hierarchy.level.CurrentMember),Measures.Measure)

This return an error:

ERROR #5001: No member provider object found for member function: MEMBER(5)

All syntax is correct. I checked it twice.
If i user cubes default MEASURE.%COUNT it works just fine, but i don't need to just count rows in fact table.
COUNT([dimension].[H1].[dimension].Members, EXCLUDEEMPTY) by its own works completely fine and count what is supposed to.

Product version: IRIS 2026.1

Comments

DC AI Bot · May 28 Bot

Your AGGREGATE(%TIMERANGE(...), Measures.Measure) pattern is the right general approach for a cumulative value over a time dimension, and it has been shown to work for running totals such as:

AGGREGATE(%TIMERANGE(YourTimeDimension.hierarchy.level,YourTimeDimension.hierarchy.level.CurrentMember),Measures.YourMeasure) [1]

A similar working example for cumulative totals is:

AGGREGATE(%TIMERANGE(DateOfSale.[Actual].[MonthSold].&,DateOfSale.CurrentMember), MEASURES.[Amount Sold])

used to return revenue from a starting month up to the current member on the rows axis. [3]

For your case, the likely issue is not the AGGREGATE syntax itself, because the sources show that AGGREGATE with %TIMERANGE works with ordinary measures like %COUNT and other standard measures. [1][3][4]

Your distinct-count measure is based on:

COUNT([dimension].[H1].[dimension].Members, EXCLUDEEMPTY)

and there is evidence that COUNT-based distinct member measures are a slower/special case, with InterSystems recommending the Distinct plug-in via %KPI() instead of using MDX COUNT for distinct member count. One reported solution says the provided Distinct plug-in is intended specifically to address the inefficiency of MDX COUNT distinct-member calculations. [5]

If you are counting distinct members, the documented alternative is to use the Distinct plug-in with %KPI() syntax rather than COUNT(...). The example syntax shown is:

%KPI("Custom DC Distinct","DISTINCT",1,"%level","<level spec>","%CONTEXT") [6]

and another source states that the built-in Distinct plug-in is the recommended approach for distinct member count instead of MDX COUNT. [5]

To troubleshoot the specific ERROR #5001: No member provider object found for member function: MEMBER(5) in your environment, the available guidance is to run the generated MDX in the DeepSee Shell and inspect the query/plan/trace there. The shell supports retrieving the last Analyzer query with #, showing the query plan with plan, and enabling trace with trace on. [7][8]

I do not see a source here that explains that exact #5001 error or proves exactly why your calculated measure fails inside AGGREGATE while %COUNT works. Based on the retrieved material, the safest guidance is:

  1. Keep the cumulative pattern based on AGGREGATE(%TIMERANGE(...), measure) for running totals. [1][3]
  2. Replace the distinct-count COUNT(...Members, EXCLUDEEMPTY) measure with a Distinct %KPI()-based measure if your goal is distinct member counting. [6][5]
  3. Test the generated MDX in DeepSee Shell and inspect plan / trace to isolate whether the failure is in Analyzer-calculated-member evaluation. [7][8]

I do not have a source here that gives a direct fix for combining your exact COUNT(..., EXCLUDEEMPTY) calculated measure with AGGREGATE without error. [1][7][8][6][3][5]


Sources:

Tell us more:
Don't like the style
Not factually correct
Didn't fully follow instructions
Refused when it shouldn't have
Being lazy
More...
Submit
0 0