I have the following MDX query that calculates members and then selects those members for a specified date range:
WITH
MEMBER [Measures].[Prior] as ([Date Post Transaction].[Calendar Month Period].CurrentMember.Lag(12),[Measures].[Unique Patients])
MEMBER [Measures].[Current] as [Measures].[Unique Patients]
SELECT {[Measures].[Current],[Measures].[Prior]}
DIMENSION PROPERTIES PARENT_UNIQUE_NAME , HIERARCHY_UNIQUE_NAME ON COLUMNS , NON EMPTY Hierarchize(AddCalculatedMembers({DrilldownLevel({[Date Post Transaction].[Calendar Month Period].Children})}))
DIMENSION PROPERTIES PARENT_UNIQUE_NAME , HIERARCHY_UNIQUE_NAME ON ROWS FROM (SELECT ({[Date Post Transaction].[Calendar Month Period].&[201207],[Date Post Transaction].[Calendar Month Period].&[201208],[Date Post Transaction].[Calendar Month Period].&[201209],[Date Post Transaction].[Calendar Month Period].&[201210],[Date Post Transaction].[Calendar Month Period].&[201211],[Date Post Transaction].[Calendar Month Period].&[201212],[Date Post Transaction].[Calendar Month Period].&[201301],[Date Post Transaction].[Calendar Month Period].&[201302],[Date Post Transaction].[Calendar Month Period].&[201303],[Date Post Transaction].[Calendar Month Period].&[201304],[Date Post Transaction].[Calendar Month Period].&[201305],[Date Post Transaction].[Calendar Month Period].&[201306]})
ON COLUMNS FROM [cube])
WHERE ([Provider Billing].[Specialty Mgma Pcps].&[Cardiology: Inv-Intvl])
Basically, this query is asking for all patients within Cardiology for the current date range and prior date range by month.
This query takes 8-9 seconds to run, which is crazy. I'm using Analysis Services to run and test query times and have not ran into other tools to help optimize MDX. So my first question is, does anyone know of such tools to help optimize MDX?
My main question is what method or structure should I be using in the query to help process the results faster? I originally was not using the .lag() function and instead running a query that included each month for current and prior. I did see improved result times from this switch.
I have several reports that use this same format, just different metrics (MEASURES) and so you can imagine the load times we're getting with queries that each run 5+ seconds.