Monday, February 20, 2012

MDX multiple where condition

Is there any way in MDX to give multiple where clause:
Example in SQL:
SELECT * FROM Price
WHERE Type in("Cost1", "Cost2", "Cost3")
I have total 10 Cost types. But I need this query to return only 3 listed
above. It is simple with SQL.
My question is How to do this in MDX?
I have tried using filter but I am not getting correct values. Is there any
way in WHERE clause? Is there any other solution?
My Development environment is:
Reporting Services using Visual Studio.Net
OLAP: MDX Queries (Base Database is MS SQL Server)
Thanks,
SamThis question would more likely be answered in the OLAP newsgroup.
microsoft.public.sqlserver.olap
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Sam" <Sam@.discussions.microsoft.com> wrote in message
news:7F350E56-F781-4DDA-8C92-0045F1B0FEB5@.microsoft.com...
> Is there any way in MDX to give multiple where clause:
> Example in SQL:
> SELECT * FROM Price
> WHERE Type in("Cost1", "Cost2", "Cost3")
> I have total 10 Cost types. But I need this query to return only 3 listed
> above. It is simple with SQL.
> My question is How to do this in MDX?
> I have tried using filter but I am not getting correct values. Is there
> any
> way in WHERE clause? Is there any other solution?
> My Development environment is:
> Reporting Services using Visual Studio.Net
> OLAP: MDX Queries (Base Database is MS SQL Server)
> Thanks,
> Sam|||Use named set.
with
set [Type Cost Set] as '{ [Type].[Cost1] : [Type].[Cost3] }'
select
{ [measures] } on columns,
{ [Type Cost Set] } on rows
from cube
"Jeff A. Stucker" wrote:
> This question would more likely be answered in the OLAP newsgroup.
> microsoft.public.sqlserver.olap
> --
> Cheers,
> '(' Jeff A. Stucker
> \
> Business Intelligence
> www.criadvantage.com
> ---
> "Sam" <Sam@.discussions.microsoft.com> wrote in message
> news:7F350E56-F781-4DDA-8C92-0045F1B0FEB5@.microsoft.com...
> > Is there any way in MDX to give multiple where clause:
> >
> > Example in SQL:
> > SELECT * FROM Price
> > WHERE Type in("Cost1", "Cost2", "Cost3")
> >
> > I have total 10 Cost types. But I need this query to return only 3 listed
> > above. It is simple with SQL.
> > My question is How to do this in MDX?
> >
> > I have tried using filter but I am not getting correct values. Is there
> > any
> > way in WHERE clause? Is there any other solution?
> >
> > My Development environment is:
> > Reporting Services using Visual Studio.Net
> > OLAP: MDX Queries (Base Database is MS SQL Server)
> >
> > Thanks,
> > Sam
>
>|||Cost types are not sequential. It will not work with range. Is there anything
in MDX where condition:
Example: [Type].[Type1 or Type2 or Type3]
Sam
"mike" wrote:
> Use named set.
> with
> set [Type Cost Set] as '{ [Type].[Cost1] : [Type].[Cost3] }'
> select
> { [measures] } on columns,
> { [Type Cost Set] } on rows
> from cube
> "Jeff A. Stucker" wrote:
> > This question would more likely be answered in the OLAP newsgroup.
> > microsoft.public.sqlserver.olap
> >
> > --
> > Cheers,
> >
> > '(' Jeff A. Stucker
> > \
> >
> > Business Intelligence
> > www.criadvantage.com
> > ---
> > "Sam" <Sam@.discussions.microsoft.com> wrote in message
> > news:7F350E56-F781-4DDA-8C92-0045F1B0FEB5@.microsoft.com...
> > > Is there any way in MDX to give multiple where clause:
> > >
> > > Example in SQL:
> > > SELECT * FROM Price
> > > WHERE Type in("Cost1", "Cost2", "Cost3")
> > >
> > > I have total 10 Cost types. But I need this query to return only 3 listed
> > > above. It is simple with SQL.
> > > My question is How to do this in MDX?
> > >
> > > I have tried using filter but I am not getting correct values. Is there
> > > any
> > > way in WHERE clause? Is there any other solution?
> > >
> > > My Development environment is:
> > > Reporting Services using Visual Studio.Net
> > > OLAP: MDX Queries (Base Database is MS SQL Server)
> > >
> > > Thanks,
> > > Sam
> >
> >
> >|||with
set [Type Cost Set] as '{ [Type].[Cost1], [Type].[Cost2], [Type].[Cost3] }'
or if you want you could use the filter function, but know that using filter
the whole set is return then the results filtered so you get overhead. See
BOL.
"Sam" wrote:
> Cost types are not sequential. It will not work with range. Is there anything
> in MDX where condition:
> Example: [Type].[Type1 or Type2 or Type3]
> Sam
>
> "mike" wrote:
> > Use named set.
> >
> > with
> > set [Type Cost Set] as '{ [Type].[Cost1] : [Type].[Cost3] }'
> >
> > select
> > { [measures] } on columns,
> > { [Type Cost Set] } on rows
> > from cube
> >
> > "Jeff A. Stucker" wrote:
> >
> > > This question would more likely be answered in the OLAP newsgroup.
> > > microsoft.public.sqlserver.olap
> > >
> > > --
> > > Cheers,
> > >
> > > '(' Jeff A. Stucker
> > > \
> > >
> > > Business Intelligence
> > > www.criadvantage.com
> > > ---
> > > "Sam" <Sam@.discussions.microsoft.com> wrote in message
> > > news:7F350E56-F781-4DDA-8C92-0045F1B0FEB5@.microsoft.com...
> > > > Is there any way in MDX to give multiple where clause:
> > > >
> > > > Example in SQL:
> > > > SELECT * FROM Price
> > > > WHERE Type in("Cost1", "Cost2", "Cost3")
> > > >
> > > > I have total 10 Cost types. But I need this query to return only 3 listed
> > > > above. It is simple with SQL.
> > > > My question is How to do this in MDX?
> > > >
> > > > I have tried using filter but I am not getting correct values. Is there
> > > > any
> > > > way in WHERE clause? Is there any other solution?
> > > >
> > > > My Development environment is:
> > > > Reporting Services using Visual Studio.Net
> > > > OLAP: MDX Queries (Base Database is MS SQL Server)
> > > >
> > > > Thanks,
> > > > Sam
> > >
> > >
> > >|||I found a work around, instead getting row wise I am getting required data in
column axis.
Thanks for your help.
Sam
"mike" wrote:
> with
> set [Type Cost Set] as '{ [Type].[Cost1], [Type].[Cost2], [Type].[Cost3] }'
> or if you want you could use the filter function, but know that using filter
> the whole set is return then the results filtered so you get overhead. See
> BOL.
> "Sam" wrote:
> > Cost types are not sequential. It will not work with range. Is there anything
> > in MDX where condition:
> > Example: [Type].[Type1 or Type2 or Type3]
> > Sam
> >
> >
> > "mike" wrote:
> >
> > > Use named set.
> > >
> > > with
> > > set [Type Cost Set] as '{ [Type].[Cost1] : [Type].[Cost3] }'
> > >
> > > select
> > > { [measures] } on columns,
> > > { [Type Cost Set] } on rows
> > > from cube
> > >
> > > "Jeff A. Stucker" wrote:
> > >
> > > > This question would more likely be answered in the OLAP newsgroup.
> > > > microsoft.public.sqlserver.olap
> > > >
> > > > --
> > > > Cheers,
> > > >
> > > > '(' Jeff A. Stucker
> > > > \
> > > >
> > > > Business Intelligence
> > > > www.criadvantage.com
> > > > ---
> > > > "Sam" <Sam@.discussions.microsoft.com> wrote in message
> > > > news:7F350E56-F781-4DDA-8C92-0045F1B0FEB5@.microsoft.com...
> > > > > Is there any way in MDX to give multiple where clause:
> > > > >
> > > > > Example in SQL:
> > > > > SELECT * FROM Price
> > > > > WHERE Type in("Cost1", "Cost2", "Cost3")
> > > > >
> > > > > I have total 10 Cost types. But I need this query to return only 3 listed
> > > > > above. It is simple with SQL.
> > > > > My question is How to do this in MDX?
> > > > >
> > > > > I have tried using filter but I am not getting correct values. Is there
> > > > > any
> > > > > way in WHERE clause? Is there any other solution?
> > > > >
> > > > > My Development environment is:
> > > > > Reporting Services using Visual Studio.Net
> > > > > OLAP: MDX Queries (Base Database is MS SQL Server)
> > > > >
> > > > > Thanks,
> > > > > Sam
> > > >
> > > >
> > > >

No comments:

Post a Comment