MDX calculation based on date logic for the Jan 1 of current year through the 15th of the previous month

Hello, 
We need some help with an SSAS MDX query based on date logic. One of the problems is that I don't have access to the Cube but have been given a query example with the logic needed for the calculation. Here's the scenario; 

The ETL process will run on the first Tuesday after the 15<sup>th</sup> of a given month. The Analysis Cube data queried should include the current year up to the end of the previous month. For example, on May 19<sup>th</sup> (the first Tuesday on or after the 15th) the query should include data from January 1<sup>st</sup> through April 30<sup>th</sup>.

 

The 15<sup>th</sup> of the month is not part of the query, it is a factor in when the query is run. The query will always be in terms of complete months.

SELECT

                NON EMPTY { [Measures].[Revenue Amount],

                [Measures].[Utilization],

                [Measures].[AVG Revenue Rate],

                [Measures].[Actual Hours] }

ON

                COLUMNS,

                NON EMPTY { ([dimConsultant].[User Id TT].[User Id TT].ALLMEMBERS * [dimConsultant].[Full Name].[Full Name].ALLMEMBERS * [dimConsultant].[Employee Type].[Employee Type].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION,

                MEMBER_UNIQUE_NAME

ON

                ROWS

FROM

                ( SELECT

                                ( { [dimDate].[Week Date].[1/4/2015], [dimDate].[Week Date].[1/11/2015], [dimDate].[Week Date].[1/18/2015], [dimDate].[Week Date].[1/25/2015], [dimDate].[Week Date].[2/1/2015] } )

                ON

                                COLUMNS

                FROM

                                ( SELECT

                                                ( { [dimIsBillable].[Is Billable].&[True] } )

                                ON

                                                COLUMNS

                                FROM

                                                [SSASRBA]

                                )

                )

WHERE

                ( [dimIsBillable].[Is Billable].&[True], [dimDate].[Week Date].CurrentMember ) CELL PROPERTIES VALUE,

                BACK_COLOR,

                FORE_COLOR,

                FORMATTED_VALUE,

                FORMAT_STRING,

                FONT_NAME,

                FONT_SIZE,

                FONT_FLAGS

February 12th, 2015 12:13am

Hi Hans,

Thank you for your question.  

I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.  

Thank you for your understanding and support. 

Regards,

Free Windows Admin Tool Kit Click here and download it now
February 16th, 2015 1:46am

Not exactly sure what your requirement is. Maybe you can think about getting the current date and calculate it to assemble a string, then use StrToSet() to turn it into a valid set in your MDX?

http://sqlblog.com/blogs/mosha/archive/2007/05/23/how-to-get-the-today-s-date-in-mdx.aspx

February 19th, 2015 1:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics