Showing posts with label filter. Show all posts
Showing posts with label filter. Show all posts

Tuesday, March 27, 2012

Comparing strings in MDX

Hello gurus,

Is there an equivalent to the TSQL LIKE '%mystring%' function in MDX?

e.g. to filter a Product dimension to only those products containing 'IPOD' or whatever?

Thanks

Not in straight MDX, but it is possible to use stored procedure to do that. There is a open source project to build library of sprocs that few of us participate, and it has the implementation of Like function.

Check it out here:

http://www.codeplex.com/ASStoredProcedures/Wiki/View.aspx?title=StringFilters

HTH,

Mosha (http://www.mosha.com/msolap)

|||

Yes, there are VBA functions.

You can use InStr() as an equivalent of T-SQL like.

IMHO, using of self written stored procedure in this case is like using a cannon aganst sparrows.

|||

Mosha,

How nice to hear from you. I was at a talk by Chris Webb last Saturday and he was singing your praises. As I have been fumbling with MDX for the last couple of months I bought your Fast Track book this week because I feel I have been trying to run before I am fully clear on the basics.

The sprocs you mention look like a very useful extension to MDX, though I note that they are not recommended for a production environment at the moment. Vladimir's suggestion of using InStr seems to work fine in this case.

Thanks

|||Thanks for this Vladimir. That works just fine - I wasn't aware that these VBA functions were available.

Comparing strings in MDX

Hello gurus,

Is there an equivalent to the TSQL LIKE '%mystring%' function in MDX?

e.g. to filter a Product dimension to only those products containing 'IPOD' or whatever?

Thanks

Not in straight MDX, but it is possible to use stored procedure to do that. There is a open source project to build library of sprocs that few of us participate, and it has the implementation of Like function.

Check it out here:

http://www.codeplex.com/ASStoredProcedures/Wiki/View.aspx?title=StringFilters

HTH,

Mosha (http://www.mosha.com/msolap)

|||

Yes, there are VBA functions.

You can use InStr() as an equivalent of T-SQL like.

IMHO, using of self written stored procedure in this case is like using a cannon aganst sparrows.

|||

Mosha,

How nice to hear from you. I was at a talk by Chris Webb last Saturday and he was singing your praises. As I have been fumbling with MDX for the last couple of months I bought your Fast Track book this week because I feel I have been trying to run before I am fully clear on the basics.

The sprocs you mention look like a very useful extension to MDX, though I note that they are not recommended for a production environment at the moment. Vladimir's suggestion of using InStr seems to work fine in this case.

Thanks

|||Thanks for this Vladimir. That works just fine - I wasn't aware that these VBA functions were available.sqlsql