Question on MDX Query

Hi,
I have the following MDX query
1.WITH
2.MEMBER [GE].[GEOSUM] AS 'Sum({[GE].[TX],[GE].[OK]})'
3.SELECT {[GE].[TX],[GE].[OK]} ON ROWS,
4.{[Metrics].[Revenue]} ON COLUMNS FROM Cube1.Basic1
The o/p is follows :
Axis 1 || Revenue ||
(TX) || 1000 ||
(OK) || 2000 ||
I am trying to create this MDX query dynamically at runtime. Line 1 and 2 would come from a table. I need to add append line 3 and 4.
Is there any way that I can get the same output by replacing Line 3 (i.e {[GE].[TX],[GE].[OK]} ) with something more generic (like say [GE].[GEOSUM]....).I tried [GE].[GEOSUM].members but this returns me all the dimension members not just TX on OK.
Is anyone aware of any MDX member functions that I can use to achieve this ?
Appreciate any help/pointer in this regard.
Thanks in advance,
Joel
--

Hi Praveen,
In SSAS, we can use Order() function to specify the order. Please take a look at the following articles:
Order:
http://www.ssas-info.com/analysis-services-faq/27-mdx/792-how-in-the-report-can-i-order-date-dimension-members-in-descending-order
http://www.sqlchick.com/entries/2011/9/30/sorting-descending-in-analysis-services-for-a-date-dimension.html
If you have any questions regarding Mondrian, please discuss it in the forum below:
http://forums.pentaho.com/forumdisplay.php?79-Mondrian-Pentaho-Analysis-Services
Regards,
Elvis Long
TechNet Community Support

Similar Messages

  • Running MDX Query in BEX

    I've a question regarding MDX Query .
    1.Can we run MDX Query in BEx.
    2.If yes , then can you please tell me how and where can we run MDX Query in BEx.
    Regards,
    -Neha

    Hello,
    BEx does not support MDX. You can use MDXTEST transaction to generate the MDX select statements against queries or infocubes but it cannot be used with BEx.
    Thanks,
    Michael

  • How can ew add filter in Dataset of MDX Query

    Hi,
    I am working on TFS 2010 Report with Report Builder 3.0
    I need to fetch data on basis of Start Task Date(means when user start their task).
    So i have added a new field in a TFS Work Item Template with name StartTaskDate.
    Now i need to fetch the report FromTaskDate to TOTaskDate(Date Range Filter).
    so how can we do this with filter option?
    Can any body help me on this.
    Thanks

    Hi rohitnegi09,
    If you want @FromTaskDate and @TOTaskDate parameters are Date/Time data types, please refer to my last reply in the following thread:
    http://social.technet.microsoft.com/Forums/en-US/db75abb9-2250-463a-8ef3-70426f617329/mdx-report-on-date-range?forum=sqlreportingservices
    If you want @FromTaskDate and @TOTaskDate parameters are Text data types, we can directly type the following MDX query in the dataset:
    select
    {[Measures].[Internet Sales Amount]
    } on columns,
    {[Date].[Date].members} on rows
    from(
    select
    STRTOMEMBER("[Date].[Date].&["+@FromTaskDate+"]"):STRTOMEMBER("[Date].[Date].&["+@ToTaskDate+"]")
    ) on columns
    from [Adventure Works]
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to pass text in MDX query

    Hi All,
    I was wondering how to pass text in MDX query.
    Below mentioned is my sample query and it is working fine.
    SELECT
    {[Measures].members} ON AXIS(0),
    NON EMPTY [0MATERIAL].[LEVEL01].MEMBERS
    *[0DOC_NUMBER].[LEVEL01].MEMBERS ON AXIS(1)"
    FROM [$ZTEST]"
    WHERE {[0MATERIAL].[000012345]} ";      
    But in data base 000012345 consists of material name as “ Pepsi “
    Now based on Pepsi I want to fetch results? Is it possible?
    Thanks in advance.

    Srinivas,
    So you are using JAVA, if you consult the developer's guide there is a section specifically addressing your question the ResultSet API should handle this via the formatted
    <b>Retrieving Result Sets
    ResultSet API</b>
    Note that the concept allows for more than two axes, however a two-dimensional, table-like data set makes the
    example easy to illustrate. On the columns axis, two members (“Store Cost” and ”Store Sales”) of the measures
    dimension have been selected; on the rows axis, three members (“Berlin,” ”Hamburg,” and ”Munich”) of the City level
    of a geographical hierarchy. The dataset has six cells:
    Cells provide four mandatory properties:
    • Value — supports all common column types, for example:
    o numeric types
    o dates
    o time values
    o strings
    o null
    • Data type — int value describing the data-type (see java.sql.Types)
    • Status — state of the cell (for example, error or null)
    <b>• Formatted value — a string representation of value</b>
    You can retrieve text in this manner.
    Do you want to be able to pass text as if it were a value as well?
    Cheers,
    Scott

  • Date parameters using MDX query

    Hello experts,
    Not sure if this question falls under SSAS or SSRS but I'm writing it here for now and hopefully get the answer.
    I'm using SSAS cube to develop a report using SSRS and this is the first time I'm doing it. I want to filter records based on date range and did some research online. My report contains two datasets:
    1. dsMain dataset -> it contains all the field which I want to use in the report and added a parameter thru query designed with following settings:
    Dimension : Dates
    Hierachary : Date
    Operator : Range (Inclusive)
    Parameters : checked
    it created two parameters called FromDatesDate and toDatesDate
    2. I created another dataset called dsDate and wrote a custom query (found at following link) and changed FromDatesDate and ToDatesDate using this date dataset
    https://jsimonbi.wordpress.com/2011/03/22/using-a-date-parameter-in-ssrs-with-mdx/
    Query for dsDate
    WITH
    MEMBER DateValue
    AS
       [Dates].[Date].CurrentMember.UniqueName
    MEMBER DateLabel
    AS
       [Dates].[Date].CurrentMember.Name
    SELECT
        [Measures].[DateValue],
        [Measures].[DateLabel]
    } ON 0,
         [Dates].[Date].[Date]
    } ON 1
    FROM [myCube]
    Here is the value returned by dsDate dataset (above query)
                            DateValue                          DateLabel
    06/04/1980 [Dates].[Date].&[29375]
    06/04/1980
    06/05/1980 [Dates].[Date].&[29376]
    06/05/1980
    06/06/1980 [Dates].[Date].&[29377]
    06/06/1980
    06/07/1980 [Dates].[Date].&[29378]
    06/07/1980
    06/08/1980 [Dates].[Date].&[29379]
    06/08/1980
    06/09/1980 [Dates].[Date].&[29380]
    06/09/1980
    06/10/1980 [Dates].[Date].&[29381]
    06/10/1980
    06/11/1980 [Dates].[Date].&[29382]
    06/11/1980
    06/12/1980 [Dates].[Date].&[29383]
    06/12/1980
    06/13/1980 [Dates].[Date].&[29384]
    06/13/1980
    Here is what I changed in FromDatesDate and ToDatesDate parmeter:
    Under Available Values tab:
    Dataset : dsDate
    Value Field : DateValue
    Label Field : DateLabel
    Here are my questions:
    1. I want to use date/time parameter so that user doesn't have to scroll thru whole date dimension.
    2. I changed the FromDatesDate and ToDatesDate to date/time parameter, removed the values from Available values tab and made the following changes on Parmaeters expression under dsMain dataset
    =”[Dates].[Date].&[” + Format(CDate(Parameters!FromDatesDate.Value),”MM/dd/yyyy”)
    + “T00:00:00]”
    =”[Dates].[Date].&[” + Format(CDate(Parameters!ToDatesDate.Value),”MM/dd/yyyy”)
    + “T00:00:00]”
    Now when I run the report I get following error:
    Query (1, 55) The restrictions imposed by the CONSTRAINED flag in the STRTOMEMBER function are violated.
    I think the reason is by changing parameter to date/time, now I cannot get "DateValue" which is required for the query.
    1. What is the best way to work with date parameters?
    Hope it is all clear and look forward to hear from experts.
    Thanks,
    P
    mark it as answer if it answered your question :)

    Hi Parry2k,
    In Analysis Services, a member can be referenced by either its member name or by its member key. The member key is used by the dimension to specifically identify a given member. The ampersand (&) character is used in MDX to differentiate
    a member key from a member name. In this scenario, the datetime is member name, not the member key. So you should not add "&".
    Reference:
    Member Names and Keys
    Simon Hou
    TechNet Community Support

  • SLOW MDX Query in an Environment but Fast in another

    A query runs slow in one environment but fast another : here's what I looked for so far without any luck.
    It takes 2 seconds to execute the query below in QA vs 20 seconds in prod.
    QA cube size is 430.81 MB - 474.54 MB on PROD
    Cubes match in environments
    Compared QA and PROD properties and they match (database and server Analysis services)
    Restarted services on both machines
    Looking at SQL server provider seems that the query has no significant effect on the CPU
    Seems there's a spike in pages/sec when the MDX query runs – the VM size is slightly > in PROD than in QA this shouldn’t affect it .Looked at the Storage Engine queries ,MDX counters and Nothing stands out
    here's the query
    SELECT NON EMPTY
    CrossJoin(CrossJoin(Hierarchize(AddCalculatedMembers({DrilldownLevel({[Sector].[Sector].[All]})})),
    Hierarchize(AddCalculatedMembers({DrilldownLevel({[Security].[Sec Type].[All]})}))),
    Hierarchize(AddCalculatedMembers({DrilldownLevel({[Broker].[Broker].[All]})})))
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,[Sector].[Sector].[Sector],[Broker].[Broker].[Broker],[Broker].[Broker].[Company Code]
    ON COLUMNS
    FROM [TradeAndCommission]
    WHERE ([Measures].[Broker Par Pct]) CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
    eddy.a

    Hi Eddy,
    Thank you for your question. 
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 
    Thank you for your understanding and support.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Help rerading the MDX query

    <p><span style=" font-family: Verdana;">Hi Gurus,</span></p><p> </p><p><span style=" font-family: Verdana;">I am</span> <span style=" font-family: Verdana;">at a learning stage to learn the MDX query.Could anyone help me with some link or book from where i can getthe syntax of some function with examples to understandthem.</span></p><p> </p><p><span style=" font-family: Verdana;">thanks</span></p><p> </p><p> </p>

    2 good books are MDX Solutions Second Edition, by George Spofford. This is a very good book, in depth, with a lot of material. George Spofford is also a regular contributor to this site, so if you have questions about any of the material, you could post here and he has proven to be very good about responding to questions.<BR>Another good book is Fast Track to MDX. This is also a good book. It's a quicker read and a little easier to get through then MDX Solutions, but the concepts are more fundamental and not as in depth, I think both books are worth reading.<BR>Other than that, there is a lot of material on this site, tech guides, white papers, etc that should be useful too.<BR><BR>HTH

  • Run mdx query in batch

    Hi,
    I am using BW MDX Driver to report off SAP BW data. Sometimes the returned data may be too much according to user selection. My question is, is there any way to run the MDX query in batch, so that the data is not returned all at once?
    For opensql or infoset driver, we can configure the query to run in batch by adding some system environment variables. But for MDX, I have no idea now.
    Thanks,
    Ray

    Hi,
    Are you including the parameter that you must have created in Crystal Reports in the Select Expert. You need to include the parameter within the record selection or group selection formula of the Select Expert, as may be applicable. Only then the values returned by the database would be in accordance to the input by the user.
    For instance, let us assume that you have created the Country parameter in Crystal Reports. In order to return data as per input fed within the County parameter during Report Refresh, the formula in Select Expert would be somewhat like :
    {Customer.Country} = {?Country}
    Please do this preliminary check before thinking of using Open SQL or InfoSet driver instead of the MDX driver or feeding the environment variables through batch processing.
    Regards,
    Amogh.

  • VAL_FIELD selection to determine RSDRI or MDX query: performance tuning

    according to on of the HTG I am working on performance tuning. one of the tip is to try to query base members by using BAS(xxx) in the expension pane of BPC report.
    I did so and found an interesting issue in one of the COPA report.
    with income statement, when I choose one node gross_profit, saying BAS(GROSS_PROFIT), it generates RSDRI query as I can see in UJSTAT. when I choose its parent, BAS(DIRECT_INCOME), it generates MDX query!
    I checked DIRECT_INCOME has three members, GROSS_PROFIT, SGA, REV_OTHER. , none of them has any formulars.
    in stead of calling BAS(DIRECT_INCOME), I called BAS(GROSS_PROFIT),BAS(SGA),BAS(REV_OTHER), I got RSDRI query again.
    so in smmary,
    BAS(PARENT) =>MDX query.
    BAS(CHILD1)=>RSDRI query.
    BAS(CHILD2)=>RSDRI query.
    BAS(CHILD3)=>RSDRI query.
    BAS(CHILD1),BAS(CHILD2),BAS(CHILD3)=>RSDRI query
    I know VAL_FIELD is SAP reserved name for BPC dimensions.  my question is why BAS(PARENT) =>MDX query.?
    interestingly I can repeat this behavior in my system. my intention is to always get RSDRI query,
    George

    Ok - it turns out that Crystal Reports disregards BEx Query variables when put in the Default Values section of the filter selection. 
    I had mine there and even though CR prompted me for the variables AND the SQL statement it generated had an INCLUDE statement with hose variables I could see by my result set that it still returned everything in the cube as if there was no restriction on Plant for instance.
    I should have paid more attention to the Info message I got in the BEx Query Designed.  It specifically states that the "Variable located in Default Values will be ignored in the MDX Access".
    After moving the variables to the Characteristic Restrictions my report worked as expected.  The slow response time is still an issue but at least it's not compounded by trying to retrieve all records in the cube while I'm expecting less than 2k.
    Hope this helps someone else

  • MDX Query Editable in BO 3.0?

    Hello, everyone,
    We are building BObj Universes in Version 3.0 against SAP BEx Queries. We have installed the "flattening error" service packs on the BW side, and have read and worked through the forum posts.  Our issue is creating objects in the Universe, with the guidelines outlined by Didier in "OLAP universes best practices" document.
    We can create simple objects in the Universe, but when we try to add the MDX functions to perform a rolling aggregate across time (the last 12 fiscal periods) or to find the corresponding value for the same period for one year ago, we get an error in the report.
    So, we have a couple of questions:
    1. Is there anyplace to see / edit the MDX query, like can be done in a relational universe?
    2. Where exactly in the Universe does the syntax outlined in Didier's Best Practice document go? We have tried in the Universe object definition, but cannot see anywhere else to place the syntax.
    Thanks for any assistance!
    Regards,
    Judy

    Hi Judy,
    Here is an example  of YTD on previous member:
    <EXPRESSION> SUM(YTD([0CALMONTH].PrevMember), [Measures].[4OHSNHMBZDWBV5J6NOYCWXZXV]) </EXPRESSION>
    You can also use MDX expression such as PERIOSDTODATE or PARALLELPERIOD for returning the value of a n previous member at a given level.
    Example, measure for the 3rd previous member at any level:
    <EXPRESSION> ( [Measures].[4OHSNHMBZDWBV5J6NOYCWXZXV], PARALLELPERIOD( [0CALMONTH].currentmember.level, 3, [0CALMONTH].currentmember)   ) </EXPRESSION>
    Example, YTD with parallelperiod:
    <EXPRESSION> SUM(YTD( PARALLELPERIOD( [0CALMONTH].currentmember.level, 1, [0CALMONTH].currentmember)  ), [Measures].[4OHSNHMBZDWBV5J6NOYCWXZXV]) </EXPRESSION>
    Please have a look on the Microsoft documentation for parallelperiod:[http://technet.microsoft.com/en-us/library/ms145500.aspx]
    Best regards
    Didier

  • MDX Query: Equivalent of SQL's "IN" clause

    Hi,
    In SQL, we have an option of viewing data of multiple members by specifying IN as follows:
    SELECT column1 from TABLE WHERE
    column2 in ('value1','value2');
    Is there any equivalent of that in MDX?
    Let's say my outline is like this:
    --Products (Standard Dimension)
    |_____Computers (+)
    |_____ Televisions (+)
    |_____Others (+)
    --Regions (Standard Dimension)
    |_____North(+)
    |_____ South (+)
    |_____East(+)
    |_____West(+)
    --Measures (Accounts Dimension)
    |_____Estimate Sales
    |_____Actual Sales
    I would like to answer this question:
    What is the actual sales and estimate sales of each product in "North" and "East" regions?
    If the region constraint is not there, the MDX query would be:
    SELECT Products.Members on Rows
    {[Estimate Sales], [Actual Sales]} on Columns
    from appName.dbName
    How do I modify this query to include only North and East regions, and still selecting product on rows?
    Thanks in advance.
    Regards,
    Vivek Ganesan

    Just add a where condition:
    WHERE
    ({[Regions].[North], [Regions].[East})
    for more info:
    Member range specification:
    http://docs.oracle.com/cd/E12825_01/epm.111/esb_techref/mdx_memberrange.htm
    Slicer specification:
    http://docs.oracle.com/cd/E12825_01/epm.111/esb_techref/mdx_slicer_spec.htm
    Hope this helps

  • Missing field for MDX query for All Members

    Hello,
    I'm using MDX query with SSRS for report and I ran into this issue:
    Query 1:
    select non empty ([Product].[Category].allmembers*[Date].[Calendar].[Calendar Year].allmembers ) on 1,
    ([Measures].[Internet Sales Amount]) on 0
    from [Adventure Works]
    go
    Query 2
    select non empty ([Product].[Category].[All]*[Date].[Calendar].[Calendar Year].allmembers ) on 1,
    ([Measures].[Internet Sales Amount]) on 0
    from [Adventure Works]
    In case I run query 2 in SSDT (query designer), it doesn't return first column whereas if I run above two queries in SSMS, I get similar columns/fields.
    How it can be resolved in SSRS to return all columns for query 1 and 2.
    Thanks,
    P
    mark it as answer if it answered your question :)

    Hello,
    I'm using MDX query with SSRS for report and I ran into this issue:
    Query 1:
    select non empty ([Product].[Category].allmembers*[Date].[Calendar].[Calendar Year].allmembers ) on 1,
    ([Measures].[Internet Sales Amount]) on 0
    from [Adventure Works]
    go
    Query 2
    select non empty ([Product].[Category].[All]*[Date].[Calendar].[Calendar Year].allmembers ) on 1,
    ([Measures].[Internet Sales Amount]) on 0
    from [Adventure Works]
    In case I run query 2 in SSDT (query designer), it doesn't return first column whereas if I run above two queries in SSMS, I get similar columns/fields.
    How it can be resolved in SSRS to return all columns for query 1 and 2.
    Thanks,
    P

  • Date format with BW MDX Query driver

    Hi,
    I have a question regarding the BW MDX Query driver.
    I have updated the driver from BW Query to BW MDX Query on my crystal reports and all the Date fields have been converted to Strings. Has anyone experienced the same issue?
    Thanks,

    Hi Abhilash
    Thanks for the reply. We have two different environments and are using Crystal XI R2 and Crystal 11. We have installed SAP Integration toolkit XI R2 and SAP GUI 7.1 Patch 14. The date issue is appening in both environments.
    Does MDX supports Date fields/formats?
    Thanks,

  • How MDX query will work while we run BOXIR3 query!

    Hi All,
    I am facing lots peformance issues in terms of reports while running.
    Can somebody can explain how the query runs at backend like when we hit Run query in Webi how it functioins.When the MDX Query will be generated and how the query hits the BI/Underlying database.
    I am basically looking out what happens behind the screen when we run a report in Back end etc.
    I am using BI7.0 and BOXIR3.. Thanks in advance for reply.

    ok Thanks for your reply.Here are the answers for your questions.
    I)how many items are in the BI query ?
    52 dimensions it has and 15 keyfigures(ckfs,Rkfs) and around 250 details objects
    but we are using only the dimension objects in reports,we are not using detail objects I mean to say hardly 3 detail objects we are using in each report.
    Since these objects are navigationla attributes they are automatically created in universe as detailed objecs.So if we remove the detail objects does the performance will increase considerably?
    CAN YOU PLEASE COMMENT ON THIS
    II)how many items are using in the Web Intelligence query panel for each report ?
    In webI Query Panel roughly for each report we are using 10 Dimensions and 5 Keyfigures(Including Ckf,Rkfs) with 6 Prompts
    III)Do the reports share characteristics ? If yes - how many ?
       Yes they share charactorstics .Maximum upto 7 Characterstics  which are shared among the reports like Country,Post code,Group,Tier

  • SAP BW Query Vs SAP BW MDX Query

    Dear Gurus,
    Can someone please tell me the difference and advantages of connecting Crystal Reports2008 to  "SAP BW Query" & "SAP BW MDX Query"while .
    My main concern being SAP BI resource is , we don't create SAP MDX queries in BW.
    Regards,
    -Neha

    Hi Ingo ,
    So the Crystal report  datasource will be SAP BEx queries when we select the connection SAP BW MDX Queries .
    My question is do we have to write MDX statements somewhere in SAP BW  or the system will automatically generate when we select the SAP BW MDX Queries ?
    Regards,
    -Neha

Maybe you are looking for

  • Question about Installing CF9 on Linux

    Hi, I have a strange situation and I'm not sure where to go, so here I am. Machines are Linux 64-bit. My clients had someone tar up the /opt/coldfusion9 directory and copied to a new machine. They un-tar the package and said that it is running instea

  • Report output to excel format

    Hi Experts, My requriement is I have to send a mail with report output in excel format as an attachment. I wrote the below subroutine for building excel sheet but I am getting output in the single row.  I am using version 4.6 Please  help me regardin

  • SQL Query rewrite, remove ORDER BY clause

    Hello, we've just installed a proprietary application which uses an Oracle 11.2.0.2 RAC database. We've seen that one of the auto-generated application's queries has poor performance (3-5 minutes for results), the query does a SELECT and at the end i

  • Copy Se16

    Hello, i need your help/experiences. Regarding SOX we have to close our productive system. If the system is closed, maintaining all tables with se16 is not possible. Now we have a few (over 100) own customizing tables (only in x and y namespace) wher

  • Workstation Requirements for SAP SRM 5.0

    Hi All- We have a requirement from our client to provide all all possible workstation requirements for SAP SRM 5.0 to be running on Users Work station. I searched OSS notes but found none. Can anybody please share any information that you guys might