Hi All. Yet another newbie to SSAS here.I'm trying to write a query which select data about financial transactions. The requirement is to select the the last 3 years. (Current year and 2 previous). We're trying to build a dashboard whihc will have a dozen charts on it, using a simialr approach.The current year would be provided as a parameter, or derived from a subquery.So far I have my query working using a range, but it's hard coded. How do change it so that it is dynamic? This is the query so far:[code="sql"] SELECT NON EMPTY { [Measures].[Actuals], [Measures].[Forecast] } ON COLUMNS, NON EMPTY { ([Financial Periods].[Financial Periods].[Financial Year].ALLMEMBERS * [Financial Periods].[Financial Period Status].[Financial Period Status].ALLMEMBERS * [Financial Periods].[Financial Period Of Year].[Financial Period Of Year].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM (SELECT ( {[Financial Periods].[Financial Periods].[Financial Year].&[2011-07-01T00:00:00]:[Financial Periods].[Financial Periods].[Financial Year].&[2013-07-01T00:00:00] } ) ON COLUMNS FROM [Financials])WHERE ( [Chart Of Accounts].[Chart Of Accounts].[Level 2].&[OPEX] ) [/code]What I want to do is derive the "currentyear" and in the "where clause" say: from currentyear:currentyear-2So.. How do I set the "current year", and then how do I refer to it with my range filter? Is there a better way of doing this? is Filter() better? if so why?Any help or suggestions would be greatly appreciated.CheersPete
↧