dbTalk Databases Forums  

MDX: when the customer bought the last time

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


Discuss MDX: when the customer bought the last time in the microsoft.public.sqlserver.olap forum.



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

Default MDX: when the customer bought the last time - 10-22-2004 , 06:24 AM






Hi MDX experts,
I would like to create calculated mamber in my cube to known, when customers bought the last time.

My OLAP cube is similar to Sales cube in FoodMart 2000, so when I run in FoodMart :

select
Descendants([Time].[1997],[Time].[Month]) on 0,
[Customers].[All Customers].[USA].[CA].[Altadena].Children ON ROWS
from sales
where ( [Measures].[store sales] )

I got customers name on rows and months on columns. I see that customer Alice Cantrell bought for the last time on december, Amy Pertanoff on July, Angel Arevalo on August and so on.

In my cube I need to create calculated member, that shows when the customer bought for the last time. When browsing, cube should return only customer name on rows and the member "Last date" on columns.

Any ideas?

Ramunas

Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default RE: MDX: when the customer bought the last time - 10-22-2004 , 07:33 AM






Try:

with member Time.LastDate as 'Tail(Filter(Time.Month.Members, Not
IsEmpty(([Unit Sales],Customers.CurrentMember)))).Item(0).Item(0).Name '
select
{ Descendants([Time].[1997],[Time].[Month]) , LastDate} on 0,
[Customers].[All Customers].[USA].[CA].[Altadena].Children ON ROWS
from sales
where ( [Measures].[store sales] )

Of course it would be clearer if member names in Foodmarrt included the
Year, but you can control this in your Time Dimension.
HTH,
Brian
www.geocities.com/brianaltmann/olap.html



"Ramunas Balukonis" wrote:

Quote:
Hi MDX experts,
I would like to create calculated mamber in my cube to known, when customers bought the last time.

My OLAP cube is similar to Sales cube in FoodMart 2000, so when I run in FoodMart :

select
Descendants([Time].[1997],[Time].[Month]) on 0,
[Customers].[All Customers].[USA].[CA].[Altadena].Children ON ROWS
from sales
where ( [Measures].[store sales] )

I got customers name on rows and months on columns. I see that customer Alice Cantrell bought for the last time on december, Amy Pertanoff on July, Angel Arevalo on August and so on.

In my cube I need to create calculated member, that shows when the customer bought for the last time. When browsing, cube should return only customer name on rows and the member "Last date" on columns.

Any ideas?

Ramunas

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.