dbTalk Databases Forums  

New User - Monthly Column Data

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


Discuss New User - Monthly Column Data in the microsoft.public.sqlserver.olap forum.



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

Default New User - Monthly Column Data - 07-25-2005 , 02:10 PM






Hi

I am a new user to mdx but not to SQL Reporting services


Basically the data I have has monthly sales going back 5 years by
Barcode number.

So I want to end up with barcode on the rows and Year/Month on the
columns.

My question is, How do I firstly only select the most recent 24 months
(I think it might be to do with the .Item() command but the book I have
is a bit lame).

And secondly how do I rename the columns i.e Month-1, Month-2....
Month-24

This way I will be able to produce a table structure in SQL Reporting
Services without having to change the column heads everytime I get a
new data update.

Please help!

Any other ideas will be greatly appreciated

Thanks in advance

Denver


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

Default Re: New User - Monthly Column Data - 07-25-2005 , 11:02 PM






One approach would be to place both Barcode and Time on rows, with a
Calculated Text Measure for the relative month; and use a Matrix Report
to place months on columns.

Here's an example of a Foodmart Sales MDX query:

Quote:
With Set [Recent6Months] as
'Tail(NonEmptyCrossJoin([Time].[Month].Members), 6)'
Member [Measures].[MonthLabel] as
'"Month-" + CStr(6 -
Rank([Time].CurrentMember, [Recent6Months]))'

Select {[Measures].[MonthLabel],
[Measures].[Unit Sales]} on columns,
NonEmptyCrossJoin([Store].[Store Name].Members,
[Recent6Months]) on rows
from Sales
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: New User - Monthly Column Data - 07-27-2005 , 05:01 AM



Thanks Deepak, this works great!

DK


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.