dbTalk Databases Forums  

how to use less than operator on dimension in mdx queries.

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


Discuss how to use less than operator on dimension in mdx queries. in the microsoft.public.sqlserver.olap forum.



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

Default how to use less than operator on dimension in mdx queries. - 09-14-2006 , 01:25 AM






Hi,
I am new to Sql Server 2005 analysis Services. I have a Time
Dimension and I want to compare that Time dimension with a value. Eg

[Time].[Year].[Year].AllMembers < 2006 (or any other fixed year).

I have used Sets but it's not working. I have even tried < operator in
where clause, but it's not working. Can somebody help me out.

Thanks and Regards
Nitin Verma.


Reply With Quote
  #2  
Old   
Helmut Knappe
 
Posts: n/a

Default Re: how to use less than operator on dimension in mdx queries. - 09-14-2006 , 01:48 AM






Hi Nitin Verma,

you don't compare a dimension with a value. In case you want to see the
years 2001 to 2004 it is easier to put a set containing these years e.g. on
the columns, like

Select
{[2001]:[2004]} on columns,
....
Of course you can create a set and then use it.
The where clause does not work like in SQL. It is used to specify single
members in those dimensions that are not selected on an axis.

HTH
Helmut
Supporting PASS, www.sqlpass.org

"Nitin Verma" <nitin.verma.in (AT) gmail (DOT) com> schrieb im Newsbeitrag
news:1158215154.754800.270000 (AT) i42g2000cwa (DOT) googlegroups.com...
Quote:
Hi,
I am new to Sql Server 2005 analysis Services. I have a Time
Dimension and I want to compare that Time dimension with a value. Eg

[Time].[Year].[Year].AllMembers < 2006 (or any other fixed year).

I have used Sets but it's not working. I have even tried < operator in
where clause, but it's not working. Can somebody help me out.

Thanks and Regards
Nitin Verma.




Reply With Quote
  #3  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: how to use less than operator on dimension in mdx queries. - 09-14-2006 , 07:12 AM



Helmut is right, you don't often compare values in MDX, you normally
work by constructing sets. If you are using AS2005 another technique
that works in creating your sets is to use null on either side of the
range operator.

eg.

null:[Time].[Year].[2006]

....will create a set of all members from the beginning of the year level
up to the 2006 member. (effectively <= 2006)

And conversely...

[Time].[Year].[2001]:null

will give you everything from 2001 onwards (effectively >= 2001)

--
Regards
Darren Gosbell - SQL Server MVP
Blog: http://www.geekswithblogs.net/darrengosbell

In article <eeau06$jun$1 (AT) svr7 (DOT) m-online.net>, HK_noSPAM (AT) biware (DOT) com
says...
Quote:
Hi Nitin Verma,

you don't compare a dimension with a value. In case you want to see the
years 2001 to 2004 it is easier to put a set containing these years e.g. on
the columns, like

Select
{[2001]:[2004]} on columns,
...
Of course you can create a set and then use it.
The where clause does not work like in SQL. It is used to specify single
members in those dimensions that are not selected on an axis.

HTH
Helmut
Supporting PASS, www.sqlpass.org

"Nitin Verma" <nitin.verma.in (AT) gmail (DOT) com> schrieb im Newsbeitrag
news:1158215154.754800.270000 (AT) i42g2000cwa (DOT) googlegroups.com...
Hi,
I am new to Sql Server 2005 analysis Services. I have a Time
Dimension and I want to compare that Time dimension with a value. Eg

[Time].[Year].[Year].AllMembers < 2006 (or any other fixed year).

I have used Sets but it's not working. I have even tried < operator in
where clause, but it's not working. Can somebody help me out.

Thanks and Regards
Nitin Verma.





Reply With Quote
  #4  
Old   
Nitin Verma
 
Posts: n/a

Default Re: how to use less than operator on dimension in mdx queries. - 09-14-2006 , 08:36 AM



Thanks Darren and Helmut for your advice. I will definetily give it a
try. Let's hope it works.

Thanks and Regards
Nitin Verma.


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.