Moving Distinct Count

  • I am new to MDX and need to crate a cube that can report a moving 12 month total of distinct patient visits. I can get the editor to do an "OK" syntax check but get errors on a data display. I have not been able to locate any example or discussion of such a query. The calculated measure is as follows.

    DistinctCount({(LastPeriods(12, [Timesimple2].currentmember))

    ,[Patient].[Standard].[Patient].Members})

    Any suggestions?

    Thanks --- Ron

  • This is the solution that I developed. it is not fast (at this point), but it does return correct values. (the "day" count is not 12 months)

    distinctCount(

    nonemptycrossjoin (

    {(

    LastPeriods (

    iif(timesimple2.currentmember.level.name = "Month",12,

    iif(timesimple2.currentmember.level.name = "Quarter",4,

    iif(timesimple2.currentmember.level.name = "Year",1,

    iif(timesimple2.currentmember.level.name = "Day",1,

    0)))) ,[TimeSimple2] )

    )

    }

    , { ([Patient].[Standard].[Patient].members)}

    )

    )

    Any comments/suggestions are welcome!

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply