SQL Server 2014 MDX Query: Is there a "Like" equivalent where i can column slice the data based on approximate field name?

For example I have the below MDX query where it gives me all the data i want. however i would like to column slice all the 20K DWT's in one column and all the 25K DWT's in another column. Could I replace all the information in the FROM columns section with something like  [Voyage].[Vessel Tag].&[LIKE %20K DWT%] , [Voyage].[Vessel Tag].&[LIKE %25K DWT%] ON COLUMNS?

SELECT NON EMPTY Hierarchize({DrilldownLevel({[Voyage].[Vessel Tag].[All]})}) ON COLUMNS ,
       NON EMPTY Hierarchize({DrilldownLevel({[Date].[Month].[All]})}) ON ROWS  
FROM (SELECT ({[Voyage].[Vessel Tag].&[FCCSP, 20K DWT, Eco, M],
               [Voyage].[Vessel Tag].&[FCCSP, 20K DWT, Eco, H],
               [Voyage].[Vessel Tag].&[FCCSP, 20K DWT, Eco, F],
               [Voyage].[Vessel Tag].&[FCCI, 20K DWT, Eco, Ma],
               [Voyage].[Vessel Tag].&[FCCI, 20K DWT, Eco, Le],
               [Voyage].[Vessel Tag].&[FCCI, 20K DWT, Eco, Ho],
               [Voyage].[Vessel Tag].&[FCCI, 20K DWT, Eco],
                     [Voyage].[Vessel Tag].&[FCCSP, 25K DWT, Eco, Marc],
               [Voyage].[Vessel Tag].&[FCCSP, 25K DWT, Eco, Ho],
               [Voyage].[Vessel Tag].&[FCCSP, 25K DWT, Eco, Fra],
               [Voyage].[Vessel Tag].&[FCCI, 25K DWT, Eco, Ma],
               [Voyage].[Vessel Tag].&[FCCI, 25K DWT, Eco, Le],
               [Voyage].[Vessel Tag].&[FCCI, 25K DWT, Eco, Hy],
               [Voyage].[Vessel Tag].&[FCCI, 25K DWT, Eco]}) ON COLUMNS  
      FROM [cube])
WHERE ([Date].[Year].&[2017],[Measures].[TCE])
Paul MaurielloSoftware Programmer Developer Analyst EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pawan KumarDatabase ExpertCommented:
0
Paul MaurielloSoftware Programmer Developer Analyst EngineerAuthor Commented:
I tried the below but it still give me all the individual columns. I want to have all the 20K DWT in one column and all the 25K DWT in another

SELECT NON EMPTY Hierarchize({DrilldownLevel({[Voyage].[Vessel Tag].[All]})}) ON COLUMNS ,
       NON EMPTY Hierarchize({DrilldownLevel({[Date].[Month].[All]})}) ON ROWS  
FROM (SELECT ({
               FILTER([Voyage].[Vessel Tag].[Vessel Tag],
                     Instr([Voyage].[Vessel Tag].CurrentMember.Name,'20K DWT') > 0 ),
               FILTER([Voyage].[Vessel Tag].[Vessel Tag],
                     Instr([Voyage].[Vessel Tag].CurrentMember.Name,'25K DWT') > 0 )
             }) ON COLUMNS  
      FROM [cube])
WHERE ([Date].[Year].&[2017],[Measures].[TCE])
0
Pawan KumarDatabase ExpertCommented:
We can only filter data in data ?

I think we can use filter ON ROWS..

SELECT {[Measures].[Sales]} ON COLUMNS
    , FILTER([Dim Grp].[Dim Name].[Dim Name]
        , InStr([Dim Grp].[Dim Name].MEMBER_NAME, "xxx") = 1) ON ROWS

FROM [Cube]
WHERE [Dim Time].[Year].&[2016]

see this-
https://www.codeproject.com/Tips/1081150/Wild-Card-in-MDX-Queries
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Paul MaurielloSoftware Programmer Developer Analyst EngineerAuthor Commented:
Ok then maybe a better way to come at this problem is: is there a way to add on 2 calculated columns that sums all the rows with "20 DWT" columns in one column and "25 DWT" columns in another column.

How would I write that in MDX?
0
Pawan KumarDatabase ExpertCommented:
How about this--

WITH
   MEMBER[measures].[avg price] AS
 '[measures].[sales_sum] / [measures].[sales_n]'
SELECT
   { [measures].[sales_sum] , [measures].[sales_n], [measures].[avg price] }
 ON COLUMNS,
   { [date].[all date].[march], [date].[all date].[april] } ON ROWS
FROM mddbcars

Open in new window


http://support.sas.com/documentation/cdl/en/mdxag/59575/HTML/default/viewer.htm#a002423087.htm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Paul MaurielloSoftware Programmer Developer Analyst EngineerAuthor Commented:
Thank you. You rock.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSAS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.