dbTalk Databases Forums  

Calculating the sum upto the previous period dynamically.

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


Discuss Calculating the sum upto the previous period dynamically. in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dravid20@hotmail.com
 
Posts: n/a

Default Calculating the sum upto the previous period dynamically. - 11-23-2005 , 03:35 PM






For example if I have 2 dimensions
Time ( year-->MOnth---> Day)
Customers
and a measure

How can I create a formula to dynamically calculate the sum of the
Unit sales for the customers for this yr upto last
month(october)...current month is November...

so for example if the current month is November, I will like to add the
sum of all the months upto october for this year..(this should be
dynamic since when december comes the sum should be upto November)

Any Ideas?

Thanks,


Reply With Quote
  #2  
Old   
Mahesh Shrestha
 
Posts: n/a

Default Re: Calculating the sum upto the previous period dynamically. - 11-23-2005 , 04:39 PM






Hi

I think you can sum up the measure for following date range.

Ancestor([Date].CurrentMember, [Month]).FirstSibling :
Ancestor([Date].CurrentMember, [Month]).Lag(1)

This should calculate the measure upto last month dynamically.

Thanks
Mahesh





*** 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.