dbTalk Databases Forums  

Calculated Measure/Annualize YTD Charge Amt

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


Discuss Calculated Measure/Annualize YTD Charge Amt in the microsoft.public.sqlserver.olap forum.



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

Default Calculated Measure/Annualize YTD Charge Amt - 05-18-2006 , 02:54 PM






Hi,
I have posted this question serveral days ago and have not received a
respond; therefore, I am posting it again. Any assistant and/or help is
greatly appreciated.


I am having some difficulty creating a calculated measure in MS SQL 2000
Analysis Services that will produce "Year End Forcast". Basically I need to
annualize the current YTD Charge Amt (comission) by dividing by the number of
months that have past already and then multiplying it by 12 months.

YTD Charge Amt =
SUM(PeriodsToDate([PERIOD].[Year],[PERIOD].CurrentMember),[Measures].[Charge
Amt])

Any help or assistant is greatly appreciated...

Regards
Fernando Sanchez


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-18-2006 , 06:51 PM






Hi Fernando,

You can try:

[Measures].[Year End Forcast] =
Quote:
([Measures].[YTD Charge Amt]
* Count(Descendants(Ancestor(
[PERIOD].CurrentMember,
[PERIOD].[Year]),
[PERIOD].CurrentMember.Level)))
/ Count(PeriodsToDate(
[PERIOD].[Year],
[PERIOD].CurrentMember))
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


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

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-19-2006 , 01:23 PM



Hi Deepak,
Thanks for responding...You have help a great deal. I have created the
calculated measure as you suggested. It work fine if I drill into the last
month that I have data for; any other month, the "Year End Forecast" is
different. Currently, I only have two month of data for the current year.
Therefore, my "Year End Forecast" should as follows:

JAN $4,586,976.00
FEB $5,106,216.00
Ytd $9,693,192.00
YEF = (($4,586,976.00 + $5,106,216.00)/2)*12
= ( $9,693,192.00/2)*12
= $4,846,596.00 * 12
= $58,159,152.00

If my period is Mar and I do not have any data, the YEF should still be
$58,159,152.00. Also, If my period is 2006, the YEF should still be
$58,159,152.00



"Deepak Puri" wrote:

Quote:
Hi Fernando,

You can try:

[Measures].[Year End Forcast] =

([Measures].[YTD Charge Amt]
* Count(Descendants(Ancestor(
[PERIOD].CurrentMember,
[PERIOD].[Year]),
[PERIOD].CurrentMember.Level)))
/ Count(PeriodsToDate(
[PERIOD].[Year],
[PERIOD].CurrentMember))



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #4  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-19-2006 , 03:27 PM



Fernando,

The behavior you're describing is different than my original
interpretation. Here's an expression to extrapolate Charges for the
current year, regardless of which member of the year is selected. You
can further refine it to meet your needs:

[Measures].[Year End Forcast] =
Quote:
Sum(Ancestor([PERIOD].CurrentMember,[PERIOD].[Year]),
([Measures].[Charge Amt] *
Count(Descendants(PERIOD].CurrentMember,,LEAVES)))
/ Count(NonEmptyCrossJoin(Descendants(
PERIOD].CurrentMember,,LEAVES))))
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


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

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-19-2006 , 04:27 PM



Hi Deepak,
I am trying to create the calculated measure recommend below and I am
getting an error.

"Deepak Puri" wrote:

Quote:
Fernando,

The behavior you're describing is different than my original
interpretation. Here's an expression to extrapolate Charges for the
current year, regardless of which member of the year is selected. You
can further refine it to meet your needs:

[Measures].[Year End Forcast] =

Sum(Ancestor([PERIOD].CurrentMember,[PERIOD].[Year]),
([Measures].[Charge Amt] *
Count(Descendants(PERIOD].CurrentMember,,LEAVES)))
/ Count(NonEmptyCrossJoin(Descendants(
PERIOD].CurrentMember,,LEAVES))))



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #6  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-19-2006 , 04:48 PM



Fernando,

Here's a sample Foodmart query which may help:

Quote:
With Member [Measures].[Year End Forecast] as
'Sum({Ancestor([Time].CurrentMember,Time.[Year])},
([Measures].[Unit Sales] *
Count(Descendants([Time].CurrentMember,,LEAVES)))
/ Count(NonEmptyCrossJoin(Descendants(
[Time].CurrentMember,,LEAVES))))'
select {[Measures].[Unit Sales],
[Measures].[Year End Forecast]} on 0,
Descendants([Time].[1997]) on 1
from Sales
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #7  
Old   
fsanchez
 
Posts: n/a

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-19-2006 , 05:04 PM



Hi Deepak,
I already have the YTD CHARGE AMT...All I need to know is the count for the
months that have data or the cell that are not empty within calendar year at
the lowest level. Since I only have two month loaded for the current
calendar year, I then take the YTD CHARGE AMT/2. Afterward then I multiply
it by the number of leave level member in the calendar year. In this case it
is 12 months. My period is broken down by YEAR, QTR, MONTH. Hope this help.

"Deepak Puri" wrote:

Quote:
Fernando,

Here's a sample Foodmart query which may help:


With Member [Measures].[Year End Forecast] as
'Sum({Ancestor([Time].CurrentMember,Time.[Year])},
([Measures].[Unit Sales] *
Count(Descendants([Time].CurrentMember,,LEAVES)))
/ Count(NonEmptyCrossJoin(Descendants(
[Time].CurrentMember,,LEAVES))))'
select {[Measures].[Unit Sales],
[Measures].[Year End Forecast]} on 0,
Descendants([Time].[1997]) on 1
from Sales



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #8  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-19-2006 , 08:22 PM



Fernando,

I'd suggest trying the query I posted - [YTD CHARGE AMT] may not be that
relevant, based on your description. For example, if data is loaded for
Jan and Feb, but the current time member selected is Jan, I assume that
you still want to extrapolate the forecast charge based on both Jan and
Feb data. But [YTD CHARGE AMT] will only reflect Jan data.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #9  
Old   
fsanchez
 
Posts: n/a

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-20-2006 , 10:13 AM



You are right...I will only give me the YTD Charge Amt for the period
selected...Which query are you referring to? The one prior to the FoodMart
is giving me errors.

"Deepak Puri" wrote:

Quote:
Fernando,

I'd suggest trying the query I posted - [YTD CHARGE AMT] may not be that
relevant, based on your description. For example, if data is loaded for
Jan and Feb, but the current time member selected is Jan, I assume that
you still want to extrapolate the forecast charge based on both Jan and
Feb data. But [YTD CHARGE AMT] will only reflect Jan data.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***


Reply With Quote
  #10  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Calculated Measure/Annualize YTD Charge Amt - 05-22-2006 , 09:52 AM



I was referring to the Foodmart query - it's based on the prior
expression (which isn't itself a query); but the syntax is likely to
work, since the query executes.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

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.