EXPLANATION
We have OLAP cube, there is Measure Customer Count which is DistinctCount of CustomerId.
Now we created SSRS report that using previously mentioned cube as data source. In the report we calculating Month to Date data.
EXAMPLE
If we use filter in SSRS report 2023-12-04, we should get data of the following days: 12-01, 12-02, 12-03
SAMPLE DATA
Date Distinct Customer Count
2023-12-01 125
2023-12-02 110
2023-12-03 115
EXPECTED RESULTS
Month to Date Customer Count = 172 (this is just for sample purpose, unique customers count)
But if we're using SUM([Month to Date],[Measures].[Online Player Count]) we get 350 (sum of 3 records) what is incorrect, because the same customers could visit all 3 days (2nd visit in period shouldn't be counted).
If we using COUNT() instead of SUM(), we get Month to Date Customer Count = 3 (num of days filtered)
We need to get Customers Distinct Count of Month to Date period.
WHAT WE TRIED
IIF([Date].[Date].currentmember is [Date].[Date].[Mtd],SUM([Month to Date],[Measures].[Customer Count]))
In cube we also have Customers dimension with CustomerId attribute, so we tried to use in SSRS's MDX:
IIF(... COUNT(EXISTING [Customers].[CustomerId].[CustomerId].Members))
IIF(... COUNT(DISTINCT [Customers].[CustomerId].[CustomerId].Members))
But those not working, it returning the same Count for any day filtered.
Have you ideas how to achieve it?
UPDATE
More info:
In Dataset properties > Parameters I have declared Parameter Mtd with following expression:
="([Date].[Date].&["
+FORMAT(DateSerial(Year(Parameters!Date.Value), Month(Parameters!Date.Value), 1),"yyyyMMdd")
+ "]:[Date].[Date].&[" + FORMAT(CDATE(Parameters!Date.Value),"yyyyMMdd") + "])"
And in MDX query I set Month to Date in following:
set [Month to Date] as STRTOSet(@Mtd)
Month to Date working as expected with other data like Spent Amount, Balance and etc. Problem occurs only with Distinct Customer Count
UPDATE #2
If we're using following CustomerCount logic as @VonC suggested, we get the same number on Month to Date as on Year to Date and it not change after we trying to select different date filter.
Maybe with this SELECT ( FILTER () ) logic Distinct count of Customers should be calculated in other way?
MEMBER [Measures].[CustomerCountPerDays] AS DISTINCTCOUNT([Customers].[CustomerId].[CustomerId].Members)
MEMBER [Measures].[CustomerCount] AS SUM( [Month to Date], [Measures].[CustomerCountPerDays] )
SELECT {[Measures].[Bets], [GGR], [Change (GGR)], [Measures].[CustomerCount]} on columns,
{[Date].[Date].[MTD],[Date].[Date].[YTD]} ON ROWS
FROM (
SELECT ( FILTER(
[Partner].[Partner].[Partner].ALLMEMBERS
, [Partner].[Partner].currentmember.Properties('Member_Caption')="OurParner" )) ON COLUMNS
FROM [OurCube])
NOTE: Bets, GGR, etc. shows correct data for MTD and YTD