SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


YTD MDX Question


YTD MDX Question

Author
Message
randy.jaye
randy.jaye
Mr or Mrs. 500
Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)

Group: General Forum Members
Points: 552 Visits: 27939
I have the following MDX calculation in my SSAS cube that returns Prior YTD Sales based on the current date.

Sum(YTD(ParallelPeriod([Calendar].[Year-Quarter-Month-Week-Day].[Year],1,[Calendar].[Year-Quarter-Month-Week-Day].CurrentMember)),[Measures].[Net Sales])

This will return the YTD sales for prior year, however I need a calculation to return the total sales for the entire prior year.

(based on today's date)
Example: Current YTD sales : $5,000,000
Prior YTD sales : $5,100,000
Prior Year Sales: $8,000,000 (this is the calc I can't figure out)

Any help would be greatly appreciated...
Raunak Jhawar
Raunak Jhawar
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3703 Visits: 1944
randy.jaye (9/16/2010)
I have the following MDX calculation in my SSAS cube that returns Prior YTD Sales based on the current date.

Sum(YTD(ParallelPeriod([Calendar].[Year-Quarter-Month-Week-Day].[Year],1,[Calendar].[Year-Quarter-Month-Week-Day].CurrentMember)),[Measures].[Net Sales])

This will return the YTD sales for prior year, however I need a calculation to return the total sales for the entire prior year.

(based on today's date)
Example: Current YTD sales : $5,000,000
Prior YTD sales : $5,100,000
Prior Year Sales: $8,000,000 (this is the calc I can't figure out)

Any help would be greatly appreciated...


any specific reason for not implementing...
SELECT [MEASURES].[SALES] ON 0
WHERE [DATE DIMENSION SLICE]=YEAR

Regards/Raunak
Now a member of Linkedin

Please visit the all new Performance Point Forum
Please visit the all new Data Mining and Business Analytics Forum
randy.jaye
randy.jaye
Mr or Mrs. 500
Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)Mr or Mrs. 500 (552 reputation)

Group: General Forum Members
Points: 552 Visits: 27939
I am trying to build a calculated member in a SSAS cube. I am relatively new to this process so I may not be aware of all the techniques.

The vast majority of our reporting and analysis is ver specific to a "day". And from the "day" being reported against or analyzed, we need an easy way to provide a calculated measure that provide YTD, Prior YTD,etc. based on day the user selects. I am just not clear on how to determine the Total Prior Year Sales based on a supplied date. For example, if user (or report) uses a day of 9/20/2010 then I need to total sales for 2009.

I hope this makes sense. I guess you could call me a newbie.
Raunak Jhawar
Raunak Jhawar
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3703 Visits: 1944
randy.jaye (9/17/2010)
I am trying to build a calculated member in a SSAS cube. I am relatively new to this process so I may not be aware of all the techniques.

The vast majority of our reporting and analysis is ver specific to a "day". And from the "day" being reported against or analyzed, we need an easy way to provide a calculated measure that provide YTD, Prior YTD,etc. based on day the user selects. I am just not clear on how to determine the Total Prior Year Sales based on a supplied date. For example, if user (or report) uses a day of 9/20/2010 then I need to total sales for 2009.

I hope this makes sense. I guess you could call me a newbie.


Jaye,

The CURRENTMEMBER attribute will not help you to get the Total yearly sales
I suppose you will have to fire an all together new MDX for total sales, as mentioned above

Regards/Raunak
Now a member of Linkedin

Please visit the all new Performance Point Forum
Please visit the all new Data Mining and Business Analytics Forum
Raunak Jhawar
Raunak Jhawar
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3703 Visits: 1944

WITH MEMBER [MEASURE_NAME] AS
AGGREGATE
(
PERIODSTODATE
(
[Date].[Calendar].[Calendar Year],
[Date].[Calendar].CurrentMember
),
([Measures].[Sales Amount])
)

Note: This Measure will give you a cumulative value of total sales till current value



Regards/Raunak
Now a member of Linkedin

Please visit the all new Performance Point Forum
Please visit the all new Data Mining and Business Analytics Forum
christy4
christy4
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 4
I am a newbie also and have been getting along fine calculating YTD information but now they have asked me to come up with a Prior Year End number and am having trouble figuring out the code. I found your post and it appears as though you were trying to figure out the same issue. I am wondering if you ever got a solution to your problem and if so if you can forward it on to me.
What I am trying to find is this. The total sales for 2013 where today is 08/31/2014. I can find YTD for 08/31/2014 and YTD for 08/31/2013, but finding YTD for 12/31/2013 has me stymied. Thanks.
happycat59
happycat59
SSCrazy Eights
SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)

Group: General Forum Members
Points: 8639 Visits: 3281
Have a look at "Time Intelligence" in Book online. It is a wizard that you can use (in BIDS/SSDT) to generate the MDX code for various time based calculations.



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