dbTalk Databases Forums  

Filter function in MDX

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


Discuss Filter function in MDX in the microsoft.public.sqlserver.olap forum.



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

Default Filter function in MDX - 10-15-2003 , 11:04 PM






MDX Query works fine when filter on gender.
Why the same MDX is not working when I try to filter on
either "fname" or "lname" or "marital_status"
or "yearly_income".

Following are the MDXes which I tried.
1. Filter on "fname" property. To get names which
contain "R".

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties("fname"), "R") >
0 ) ) ON Columns
FROM [Sales]

2. Filter on "marital_status"

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties
("marital_status"), "S") >
0 ) ) ON Columns
FROM [Sales]

3.Filter on "lname" property. To get names which
contain "Ro".

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties("lname"), "Ro") >
0 ) ) ON Columns
FROM [Sales]

4. Filter on "yearly_income"

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties
("yearly_income"), "50") >
0 ) ) ON Columns
FROM [Sales]


Except "gender" property, i am not able to filter on other
properties of the member.

Why so?

Regards,
Jagan SV


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

Default Filter function in MDX - 10-16-2003 , 07:40 AM






I assume you are working with Foodmart 2000.
In such a case you should consider
that "fname", "lname", "marital_status"
and "yearly_income" are columns in the relational
table "Customers". As such they are not accesible from
MDX, unless they are explicity declared as member
properties in Dimension Editor.
"Yearly_Income" and "Marital_Status" have been created as
Member Properties, but AS removes the underscores from
their names, so if you modify your queries accordingly
they should work. To be able to filter on "fname"
and "lname" you should create the appropiate member
properties in the "Customers" dimension.
For a fuller explanation check out the "Member Properties"
topics in BOL.
HTH,
Brian
www.geocities.com/brianaltmann/olap.html


Quote:
-----Original Message-----
MDX Query works fine when filter on gender.
Why the same MDX is not working when I try to filter on
either "fname" or "lname" or "marital_status"
or "yearly_income".

Following are the MDXes which I tried.
1. Filter on "fname" property. To get names which
contain "R".

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties("fname"), "R")
0 ) ) ON Columns
FROM [Sales]

2. Filter on "marital_status"

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties
("marital_status"), "S")
0 ) ) ON Columns
FROM [Sales]

3.Filter on "lname" property. To get names which
contain "Ro".

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties("lname"), "Ro")
0 ) ) ON Columns
FROM [Sales]

4. Filter on "yearly_income"

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties
("yearly_income"), "50")
0 ) ) ON Columns
FROM [Sales]


Except "gender" property, i am not able to filter on
other
properties of the member.

Why so?

Regards,
Jagan SV

.


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

Default Filter function in MDX - 10-17-2003 , 12:55 AM



Hello,
take a look in the dimension editor.
are these properties there?
this works:

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties
("marital status"), "S") >
0 ) ) ON Columns
FROM [Sales]

HTH
Jörg


Quote:
-----Original Message-----
MDX Query works fine when filter on gender.
Why the same MDX is not working when I try to filter on
either "fname" or "lname" or "marital_status"
or "yearly_income".

Following are the MDXes which I tried.
1. Filter on "fname" property. To get names which
contain "R".

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties("fname"), "R")
0 ) ) ON Columns
FROM [Sales]

2. Filter on "marital_status"

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties
("marital_status"), "S")
0 ) ) ON Columns
FROM [Sales]

3.Filter on "lname" property. To get names which
contain "Ro".

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties("lname"), "Ro")
0 ) ) ON Columns
FROM [Sales]

4. Filter on "yearly_income"

SELECT
FILTER(Customers.[Name].ALLMEMBERS, (INSTR
(Customers.CurrentMember.Properties
("yearly_income"), "50")
0 ) ) ON Columns
FROM [Sales]


Except "gender" property, i am not able to filter on
other
properties of the member.

Why so?

Regards,
Jagan SV

.


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.