dbTalk Databases Forums  

Trying to retrieve YTD

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Trying to retrieve YTD in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tomas
 
Posts: n/a

Default Trying to retrieve YTD - 10-27-2005 , 04:53 PM






I try the following to retrieve previous year ClosePeriod, but I can not get
it to work properly.

([Measures].[Revenue],OpeningPeriod ( [Time].[Year], [Time].CurrentMember))

Please help
Tomas

Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Trying to retrieve YTD - 10-27-2005 , 07:07 PM






I think you might be looking for something like the following, getting
the closingPeriod of the previous year.

Quote:
([Measures].[Revenue],ClosingPeriod( [Time].[Year], Ancestor
([Time].CurrentMember,Year).PrevMember))
Quote:
Probably a more robust (& complicated) solution would be the one below.

* I start by getting the current time member
* then getting its year
* going back to the previous year
* getting all the leaf member under the previous year
* filtering out empty cells
* getting the last (non empty) cell

Quote:
SUM(TAIL(FILTER(DESCENDANTS
(Ancestor([Time].CurrentMember,Year).PrevMember,,LEAVES),NOT IsEmpty
([Measures].[Revenue])),1),[Measures].[Revenue])
Quote:
--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell

In article <26DC4CBF-93B0-4E71-88D4-D47DA223B757 (AT) microsoft (DOT) com>,
Tomas (AT) discussions (DOT) microsoft.com says...
Quote:
I try the following to retrieve previous year ClosePeriod, but I can not get
it to work properly.

([Measures].[Revenue],OpeningPeriod ( [Time].[Year], [Time].CurrentMember))

Please help
Tomas



Reply With Quote
  #3  
Old   
Tomas
 
Posts: n/a

Default Re: Trying to retrieve YTD - 10-28-2005 , 04:20 PM



Sorry but you answer is incorrect.
It will not work when you select a month, or a quarter which is the problem
that I am having with the following

( [Measures].[Actual Revenue],ParallelPeriod([Time].[Year] , 1 ,
[Time].Currentmember))

That will display each Month, quarter, but not sum in other words
if I select Feb 2005, it will not contain Jan and Feb 2005.

Please help

"Darren Gosbell" wrote:

Quote:
I think you might be looking for something like the following, getting
the closingPeriod of the previous year.


([Measures].[Revenue],ClosingPeriod( [Time].[Year], Ancestor
([Time].CurrentMember,Year).PrevMember))


Probably a more robust (& complicated) solution would be the one below.

* I start by getting the current time member
* then getting its year
* going back to the previous year
* getting all the leaf member under the previous year
* filtering out empty cells
* getting the last (non empty) cell


SUM(TAIL(FILTER(DESCENDANTS
(Ancestor([Time].CurrentMember,Year).PrevMember,,LEAVES),NOT IsEmpty
([Measures].[Revenue])),1),[Measures].[Revenue])


--
Regards
Darren Gosbell [MCSD]
dgosbell_at_yahoo_dot_com
Blog: http://www.geekswithblogs.net/darrengosbell

In article <26DC4CBF-93B0-4E71-88D4-D47DA223B757 (AT) microsoft (DOT) com>,
Tomas (AT) discussions (DOT) microsoft.com says...
I try the following to retrieve previous year ClosePeriod, but I can not get
it to work properly.

([Measures].[Revenue],OpeningPeriod ( [Time].[Year], [Time].CurrentMember))

Please help
Tomas




Reply With Quote
  #4  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Trying to retrieve YTD - 10-28-2005 , 07:40 PM



Sorry, but your question is not very clear, your subject line mentions
YTD and then you asked about getting the closing period for the previous
year.

If you want to do a YTD, you can do something like the following.

SUM(YTD(Time.CurrentMember), [Measures].[Actual Revenue])

This relies on your time dimension being configured properly, otherwise
you can do it manually with the following

SUM(PeriodToDate(Time.Year, Time.CurrentMember), [Measures].[Actual
Revenue])


--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell

In article <594808E5-5109-4DFF-BEC3-3C61007ECB56 (AT) microsoft (DOT) com>,
Tomas (AT) discussions (DOT) microsoft.com says...
Quote:
Sorry but you answer is incorrect.
It will not work when you select a month, or a quarter which is the problem
that I am having with the following

( [Measures].[Actual Revenue],ParallelPeriod([Time].[Year] , 1 ,
[Time].Currentmember))

That will display each Month, quarter, but not sum in other words
if I select Feb 2005, it will not contain Jan and Feb 2005.

Please help


Reply With Quote
  #5  
Old   
Tomas
 
Posts: n/a

Default Re: Trying to retrieve YTD - 10-29-2005 , 03:09 PM



Sorry about the way I enter the question. I am trying to get the sum up to
the time that I select for that year only.
1) if I select Feb 2005, it will include January and Feb 2005.
2) Another measure is to Retrieve the Previous Year YTD for the time select
above.

thank you for your time.


"Darren Gosbell" wrote:

Quote:
Sorry, but your question is not very clear, your subject line mentions
YTD and then you asked about getting the closing period for the previous
year.

If you want to do a YTD, you can do something like the following.

SUM(YTD(Time.CurrentMember), [Measures].[Actual Revenue])

This relies on your time dimension being configured properly, otherwise
you can do it manually with the following

SUM(PeriodToDate(Time.Year, Time.CurrentMember), [Measures].[Actual
Revenue])


--
Regards
Darren Gosbell [MCSD]
dgosbell_at_yahoo_dot_com
Blog: http://www.geekswithblogs.net/darrengosbell

In article <594808E5-5109-4DFF-BEC3-3C61007ECB56 (AT) microsoft (DOT) com>,
Tomas (AT) discussions (DOT) microsoft.com says...
Sorry but you answer is incorrect.
It will not work when you select a month, or a quarter which is the problem
that I am having with the following

( [Measures].[Actual Revenue],ParallelPeriod([Time].[Year] , 1 ,
[Time].Currentmember))

That will display each Month, quarter, but not sum in other words
if I select Feb 2005, it will not contain Jan and Feb 2005.

Please help



Reply With Quote
  #6  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: Trying to retrieve YTD - 10-30-2005 , 05:52 AM




Quote:
1) if I select Feb 2005, it will include January and Feb 2005.
The suggestions I had in my previous post should calculate this, the
simplest one being the following.

SUM(YTD(Time.CurrentMember), [Measures].[Actual Revenue])

Quote:
2) Another measure is to Retrieve the Previous Year YTD for the time select
above.
You can build off the measure above to get this, assuming that you have
named the measure above "YTD Revenue". The following should get the same
period (eg quarter or month) from the previous year, for the YTD Revenue
figure.

(Measures.[YTD Revenue],ParallelPeriod(Year,1,Time.CurrentMember))

HTH

--
Regards
Darren Gosbell [MCSD]
<dgosbell_at_yahoo_dot_com>
Blog: http://www.geekswithblogs.net/darrengosbell


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.