Hello everybody,
I have a cube with appointments including dimensions for companies and dates.
One of my measures is "Appointments" which is the count of all appointments. Another calculated member is "Visits" which is the count of appointments with the type of "Visits".
This is my MDX epxression for "Visits":
AGGREGATE([Appointment].[Type].&[Visit], [Measures].[Appointments])
Now I would like to create a new calculated member "Company Visits" which should be the distinct count of "Visits" by company and date.
Example: 2 "Visits" in one company on the same day should be 1 "Company Visit"
In T-SQL this query works:
COUNT( DISTINCT( CASE [Type] WHEN "Visit" THEN CAST([CompanyID] AS NVARCHAR) + CONVERT(NCHAR(8), CAST([Date] AS NVARCHAR)) ELSE NULL END ) ) AS [Company Visits]
How can I do this with MDX in calculations?
Additionally I would like to have a calculated member "Days in Field" as distinct count of dates with "Visits".
Thanks in advance and best regards
Lars