How do I perform an "average days since event" type query in mdx?
===

I have a cube that I have in the past used to report on counts of events.  Let's say for the month of July I want to break down the number of events that have occurred for each product.

I'd have something like this:

    SELECT Measures.[Count] ON COLUMNS,
    	Product.[Product Id].Members ON ROWS
    FROM [MyCube]
    WHERE [Time].[Month].[July 2012]

With an output like:

            Count
    Car     5
    Train   6

Now I want to modify the output to get something like this:

            Count   Avg Days since sale
    Car     5       12
    Train   6       14

How do I do that?

I've spent a few hours trying to find a solution to this in MDX, but can't find a way to do this. (I'm very new to MDX)

I've found several solutions that would work if I included days in either COLUMNS or ROWS.
For instance:

    WITH MEMBER Measures.[NumDays] as
        count([Time].[Date].CurrentMember :
            [Time].[Date].&[2012-07-27T00:00:00])
    SELECT
		([Time].[Date].Members,{Measures.[Count],Measures.[NumDays]}) ON COLUMNS,
		[Product].[Product Id].Members ON ROWS
	FROM [MyCube]
	WHERE [Time].[Month].[July 2012]

This gets me really close.  The result is something like:

            July 1                July 2                ...
            Count    Num Days     Count    Num Days     ...
    Car     1        24           3        23
    Train   0        24           1        23

I could use this result set and get what I want in my .NET code.  I can calculate the average days since sale by weighted average.  For car, for instance, it would be (1*24 + 3*23)/(1 + 3).  I'd have to do some mangled and unfortunate things in my .NET code to get this to work, and I'd also have to send back about 80 times as much data from the server as I need.

The problem I've been running into with MDX is that as soon as I take away [Time].[Date].Members from the result set, [Time].[Date].CurrentMember is [Time].[Date].All, and I can't do any meaningful calculations from it.

Is there a way to use the second MDX as a subquery, and rollup the values it returns in the way I need to?

The subquery approach isn't necessary for my solution, but I am curious if that can be done.  Any help would be appreciated.  Thanks in advance.