dbTalk Databases Forums  

MDX newbee

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


Discuss MDX newbee in the microsoft.public.sqlserver.olap forum.



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

Default MDX newbee - 11-18-2004 , 04:04 AM






Hi friends!
I have a problem to make a query which gives total for last (ex. 7 days).
Anything similar what I've found on the web is:
This works:

with set [TenBest] as 'TopCount([Product].[Brand Name].Members,10,[Unit
Sales])'
set [LastDay] as 'Tail(Filter([Time].[Month].Members, Not
IsEmpty([Time].CurrentMember)),1)'
set [Last7Days] as ' [LastDay].item(0).item(0).Lag(6) :
[LastDay].item(0).item(0)'
select [Last7Days] on COLUMNS,
[TenBest] on ROWS
from Sales



OK. But what if I need [Unit Sales] for one choosen store, ex. [Store].[All
Stores].[USA].[WA].[Bellingham], and I DON'T NEED first teen best:
something like this ( with error!):

with MEMBER MEASURE.[Shop] AS
'[Store].[All Stores].[USA].[WA].[Bellingham], [[Unit Sales])

set [LastDay] as 'Tail(Filter([Time].[Month].Members, Not
IsEmpty([Time].CurrentMember)),1)'
set [Last7Days] as ' [LastDay].item(0).item(0).Lag(6) :
[LastDay].item(0).item(0)'
select [Last7Days] on COLUMNS,
[Shop] on ROWS
from Sales

Only I need is [Unit Sales] for only one store last 7 days!
Please people, I'm sure someone knows that. It's very important for me!

Thanks.

VK




Reply With Quote
  #2  
Old   
Art
 
Posts: n/a

Default RE: MDX newbee - 11-18-2004 , 01:07 PM






This MDX might be the one you're looking for ...

**************************************
WITH
SET [LastDay] AS ' Tail(Filter([Time].[Month].Members, Not
IsEmpty([Time].CurrentMember)), 1) '
SET [Last7Days] AS ' [LastDay].item(0).item(0).Lag(6) :
[LastDay].item(0).item(0) '

SELECT
[Last7Days] ON COLUMNS,
{[Measures].[Unit Sales]} ON ROWS
FROM
Sales
WHERE
([Store].[All Stores].[USA].[WA].[Bellingham])
**************************************


"VK" wrote:

Quote:
Hi friends!
I have a problem to make a query which gives total for last (ex. 7 days).
Anything similar what I've found on the web is:
This works:

with set [TenBest] as 'TopCount([Product].[Brand Name].Members,10,[Unit
Sales])'
set [LastDay] as 'Tail(Filter([Time].[Month].Members, Not
IsEmpty([Time].CurrentMember)),1)'
set [Last7Days] as ' [LastDay].item(0).item(0).Lag(6) :
[LastDay].item(0).item(0)'
select [Last7Days] on COLUMNS,
[TenBest] on ROWS
from Sales



OK. But what if I need [Unit Sales] for one choosen store, ex. [Store].[All
Stores].[USA].[WA].[Bellingham], and I DON'T NEED first teen best:
something like this ( with error!):

with MEMBER MEASURE.[Shop] AS
'[Store].[All Stores].[USA].[WA].[Bellingham], [[Unit Sales])

set [LastDay] as 'Tail(Filter([Time].[Month].Members, Not
IsEmpty([Time].CurrentMember)),1)'
set [Last7Days] as ' [LastDay].item(0).item(0).Lag(6) :
[LastDay].item(0).item(0)'
select [Last7Days] on COLUMNS,
[Shop] on ROWS
from Sales

Only I need is [Unit Sales] for only one store last 7 days!
Please people, I'm sure someone knows that. It's very important for me!

Thanks.

VK





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

Default Re: MDX newbee - 11-19-2004 , 07:12 AM



Thanks !

"VK" <vkaligari (AT) tis (DOT) hr> wrote

Quote:
Hi friends!
I have a problem to make a query which gives total for last (ex. 7 days).
Anything similar what I've found on the web is:
This works:

with set [TenBest] as 'TopCount([Product].[Brand Name].Members,10,[Unit
Sales])'
set [LastDay] as 'Tail(Filter([Time].[Month].Members, Not
IsEmpty([Time].CurrentMember)),1)'
set [Last7Days] as ' [LastDay].item(0).item(0).Lag(6) :
[LastDay].item(0).item(0)'
select [Last7Days] on COLUMNS,
[TenBest] on ROWS
from Sales



OK. But what if I need [Unit Sales] for one choosen store, ex.
[Store].[All Stores].[USA].[WA].[Bellingham], and I DON'T NEED first teen
best:
something like this ( with error!):

with MEMBER MEASURE.[Shop] AS
'[Store].[All Stores].[USA].[WA].[Bellingham], [[Unit Sales])

set [LastDay] as 'Tail(Filter([Time].[Month].Members, Not
IsEmpty([Time].CurrentMember)),1)'
set [Last7Days] as ' [LastDay].item(0).item(0).Lag(6) :
[LastDay].item(0).item(0)'
select [Last7Days] on COLUMNS,
[Shop] on ROWS
from Sales

Only I need is [Unit Sales] for only one store last 7 days!
Please people, I'm sure someone knows that. It's very important for me!

Thanks.

VK






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.