0
votes

I am using Pentaho Mondrian 3.2.

I want to count the number of days in a specific range having [Measures].[CNT] > 0. The following MDX query counts all days including null and empty results:

WITH
MEMBER [Measures].[numofday]
    AS Count( Filter( [Date].[1390].[3].[10] : [Date].[1391].[3].[10]
                    , [Measures].[CNT].Currentmember > 0 ))

SELECT [Measures].[numofday] ON AXIS(0)
  FROM [Cube]

In addition, Non Empty function doesn't work in calculated member.

How can I modify this query to get the correct number of days?

1

1 Answers

1
votes

The Count function includes empty members by default; you'll have to the EXCLUDEEMPTY parameter in this case:

WITH
MEMBER [Measures].[numofday]
    AS Count( Filter( [Date].[1390].[3].[10] : [Date].[1391].[3].[10]
                    , [Measures].[CNT].Currentmember > 0 )
            , EXCLUDEEMPTY )

SELECT [Measures].[numofday] ON AXIS(0)
  FROM [Cube]