Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rvaraganti
Starting Member
22 Posts |
Posted - 2009-01-09 : 01:10:28
|
Hi,I want to write MDX query for the following requirement:we have a time dimension "[DimTime]" having date hierarchy "Year->Quarter->Period->Week->Day->Hour"Now i want to get the Cumulative sum of (Sales) for multiple periods.Ex: if i select 2 year say (2007 and 2008) and want to display by Quarter. then the result should be :2007 Q1 -> 2007 Q1 sales2007 Q2 -> 2007 Q2 Sales + 2007 Q1 Sales......2008 Q1 -> 2008 Q1 Sales + 2007 Q4 Sales2008 Q2 -> 2008 Q2 Sales + 2008 Q1 Sales.........Suggestions Please Thanks,Rachitha. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-09 : 12:28:42
|
try the belowSUM([DimTime].[Quarter].MEMBERS.Item(0):[DimTime].[Quarter].CURRENTMEMBER,your sales amount measure here) |
 |
|
rvaraganti
Starting Member
22 Posts |
Posted - 2009-01-13 : 09:56:00
|
Thanx for your response. We have written the query as per your suggestion and got the result partially. Ex: if i select 2 years say (2007 and 2008) and want to display by Quarter. then the result was:2007 Q1 -> 2007 Q1 sales ( here is the only problem, where we got total history sales as 2007 Q1 sales i.e 2006 sales + 2007 Q1 sales , but we want only 2007 Q1 sales not the previous history)2007 Q2 -> 2007 Q2 Sales + 2007 Q1 Sales (this is working fine)......2008 Q1 -> 2008 Q1 Sales + 2007 Q4 Sales (this is working fine)2008 Q2 -> 2008 Q2 Sales + 2008 Q1 Sales (this is working fine)....Please provide your suggestion on this.Thanks,Rachitha. |
 |
|
|
|
|