I am currently attempting to get a distinct count of returning customers from the Adventure Works cube on a month by month basis.
So if the customer made one to many purchases in October 2014 and November 2014, then they will be counted once in November 2014.
If they are in October 2014 but not in November 2014, then they don't get counted.
If they are not in October 2014 but they are in November 2014 then they don't get counted.
My query currently looks like this:
WITHMEMBER MEASURES.[Returning Customers] AS
DISTINCTCOUNT(
NONEMPTY(
NONEMPTY(
[Customer].[Customer].MEMBERS
, [Measures].[Sales Amount])
, {[Measures].[Sales Amount]}
* [Date].[Calendar].[Month].CURRENTMEMBER.PREVMEMBER
)
)
SELECT
{
MEASURES.[Returning Customers]
} ON COLUMNS,
[Date].[Calendar].[Month].MEMBERS ON ROWS
FROM [Adventure Works]
This shows the list of months, but every column has an #Error. What am I doing wrong?