dbTalk Databases Forums  

MDX more two filters

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


Discuss MDX more two filters in the microsoft.public.sqlserver.olap forum.



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

Default MDX more two filters - 11-22-2004 , 05:40 AM






Hi group!

How can I add more filters ( [Store Type] and [Promotion Media] ) in this
MDX query:


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

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

-- AND [Store Type].[All Store Type].[Supermarket]
-- AND [Promotion Media].[All Media].[Radio]

I know I can't put more than one condition after WHERE, but what is the
solution ?

Thanks.

VK







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

Default Re: MDX more two filters - 11-22-2004 , 06:24 AM






Hi,

yes you can... You can't use a reference to more than one member from the
same hierarchy.

cheers,
Matthias


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

SELECT
[Last7Months] ON COLUMNS,
{[Measures].[Unit Sales]} ON ROWS
FROM
Sales
WHERE
([Store].[All Stores].[USA].[WA],
[Store Type].[All Store Type].[Supermarket],
[Promotion Media].[All Media].[Radio])


"VK" <vkaligari (AT) tis (DOT) hr> schrieb im Newsbeitrag
news:OZvgehI0EHA.1300 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Quote:
Hi group!

How can I add more filters ( [Store Type] and [Promotion Media] ) in this
MDX query:


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

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

-- AND [Store Type].[All Store Type].[Supermarket]
-- AND [Promotion Media].[All Media].[Radio]

I know I can't put more than one condition after WHERE, but what is the
solution ?

Thanks.

VK









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

Default Re: MDX more two filters - 11-22-2004 , 06:54 AM



Thank you for quick replay!
Can I ask you one more question:
What if I need total sum from last 7 months (ONLY ONE number)
something like that is not working:


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

SELECT
{SUM([Last7Months],[Measures].[Unit Sales]} ON COLUMNS
FROM
Sales
WHERE
([Store].[All Stores].[USA].[WA],
[Store Type].[All Store Type].[Supermarket],
[Promotion Media].[All Media].[Radio])

what should I change ?
Thanks again.


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

Quote:
Hi group!

How can I add more filters ( [Store Type] and [Promotion Media] ) in this
MDX query:


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

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

-- AND [Store Type].[All Store Type].[Supermarket]
-- AND [Promotion Media].[All Media].[Radio]

I know I can't put more than one condition after WHERE, but what is the
solution ?

Thanks.

VK









Reply With Quote
  #4  
Old   
Matthias
 
Posts: n/a

Default Re: MDX more two filters - 11-23-2004 , 06:58 AM



You should put the sum-calculation in a calculated member, then it works.

regards,
Matthias


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

MEMBER [Time].[Sum] as
'SUM([Last7Months],[Measures].[Unit Sales])'

SELECT
{[Last7Months], [Time].[Sum]} ON COLUMNS
FROM
Sales
WHERE
([Store].[All Stores].[USA].[WA],
[Store Type].[All Store Type].[Supermarket],
[Promotion Media].[All Media].[Radio])


"VK" <vkaligari (AT) tis (DOT) hr> schrieb im Newsbeitrag
news:%23pgyDLJ0EHA.2012 (AT) TK2MSFTNGP15 (DOT) phx.gbl...
Quote:
Thank you for quick replay!
Can I ask you one more question:
What if I need total sum from last 7 months (ONLY ONE number)
something like that is not working:


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

SELECT
{SUM([Last7Months],[Measures].[Unit Sales]} ON COLUMNS
FROM
Sales
WHERE
([Store].[All Stores].[USA].[WA],
[Store Type].[All Store Type].[Supermarket],
[Promotion Media].[All Media].[Radio])

what should I change ?
Thanks again.


"VK" <vkaligari (AT) tis (DOT) hr> wrote in message
news:OZvgehI0EHA.1300 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Hi group!

How can I add more filters ( [Store Type] and [Promotion Media] ) in
this
MDX query:


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

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

-- AND [Store Type].[All Store Type].[Supermarket]
-- AND [Promotion Media].[All Media].[Radio]

I know I can't put more than one condition after WHERE, but what is the
solution ?

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.