Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Calculating measure for the current month of Previous Year


Calculating measure for the current month of Previous Year

Author
Message
yhafraoui
yhafraoui
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 31
Hello,
I would like to calculate measures in MDX for the current month of the previous year.

Example : Today, we are the 20/03/2014.
My measure Nb Open Days n-1 will be the aggregation of my measure Nb Open Days still the[color=#red] 20/03/2013[/color].

I have build my calculation like this :
SUM(
Generate
({Existing [Time].[Date].Children},
   {PARALLELPERIOD([Time].[Year - Month - Date].[Year],
1,
[Time].[Year - Month - Date].CURRENTMEMBER)
   }
),[Measures].[Nb Jour Ouvré])

Through the browser, when I put my different attributes in the body of my query, it works.

But for the time attribute "Day_Week" which contains the day of the week (monday, tuesday...), it doesn't work.
The browser displays only "(null)" value.

I don't understand why ? Someone can help me ?
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
Hi,

Today I faced a similar situation and I started using the ParallelPeriod function, but later I found this blog entry:
Retrieve selected year data and same level data from previous year

I think it would be very helpful.

Kind Regards,

Paul Hernández
yhafraoui
yhafraoui
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 31
Hello,

Thank you for your link and your help.

But, I have found this link that corresponds more to my issue :
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/d2f822a5-2a7a-4ec5-9db4-35a107d8fcb9/mdx-parallelperiod-month-to-month

Here is my MDX request if it can help :
SUM(Generate(Existing {[Time].[Date].Children},
         {PARALLELPERIOD([Time].[Year - Month - Date].[Year]
         ,1
         ,OPENINGPERIOD([Time].[Year - Month - Date].[Date],[Time].[Year - Month - Date].CurrentMember))
         :
         PARALLELPERIOD([Time].[Year - Month - Date].[Year]
         ,1
         ,TAIL(DESCENDANTS([Time].[Year - Month - Date].CurrentMember,[Time].[Year - Month - Date].[Date],LEAVES)
         ,1).Item(0))
         })
         ,[Measures].[Nb Jour Ouvré]
      Wink
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search