Search code examples
mdxiccubemdx-query

iccube : how to count number of members with where clause in a mdx?


Using the following mdx, the result is the same if I run it with or without the where clause : It returns the total nbr of years in the hierarchy.

with member nbYears as [Time].[Year].[Year].count
select nbYears on 0
from [Sales]
where [Time].[2007]

Solution

  • You can use the Existing MDX function

    WITH 
       member nbYears as (Existing [Time].[Year].[Year]).count
    SELECT nbYears on 0
    FROM [Sales]
    WHERE [Time].[2007]