Filter Function in MDX statement

Hi Experts,
I have a question on MDX, i hope this is the right place to post.
I want to exclude a certain value of an infoobject in MDX output. How can i achieve this?

Though not recommended for huge sets - are you not able to use things like not equal or not in list in your query filters?
Anyways google " OLAP universes best practices" - its a good document

Similar Messages

  • Filter in MDX Statement

    I have a very basic MDX statement which contains a FILTER statement:
    WITH
    SET [Selected Discipline] AS STRTOSET(@Disciplines, CONSTRAINED)
    SET [Selected Department] AS STRTOSET(@Departments, CONSTRAINED)
    SET [Selected Departments] AS IIF(@Disciplines = @Departments,
    FILTER(
    DESCENDANTS([Selected Discipline], [Employee].[DISC - DEPT - EMP].[Department], AFTER),
    NOT INSTR([Employee].[DISC - DEPT - EMP].CurrentMember.UNIQUE_NAME, "Freelance")),
    DESCENDANTS([Selected Department], [Employee].[DISC - DEPT - EMP].[Department], AFTER))
    SET [TTM] AS { LastPeriods(12, StrToMember(@SelectedMonth, CONSTRAINED)) }
    SELECT
    [Measures].[Employee Hours],
    [Measures].[Employee Hours %]
    } ON COLUMNS,
    NON EMPTY CROSSJOIN(
    [Selected Departments],
    [Employee].[Employee Bill Rate].[Employee Bill Rate].ALLMEMBERS,
    [Employee].[Employee Level].[Employee Level].ALLMEMBERS,
    [TTM]) ,
    FILTER ([Employee].[Manager Name].[Manager Name].Members ,
    NOT InStr([Employee].[Manager Name].CurrentMember.MEMBER_NAME, "O-Tern"))
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
    FROM [OLSON BI]
    WHERE (
    [Employee Hours Time Category].[Time Category].&[Client Facing],
    [Employee Hours Time Category].[Utilization Category].&[PRODUCTION])
    CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT
    When running the query, I get the "Failed to parse the query to detect if it is mdx or dmx".
    THe qqy=uery is basic enough, but for the life of me can't figure out what is wrong????
    Any suggestions woud be greatly appreciated!!
    Thanks
    A. M. Robinson

    I literally have the exact same query running in a different report and it runs fine.
    Also, your FILTER is in a SET statement - mine is not. That is the major difference between my query and yours.
    SELECT
    [Measures].[Employee Hours],
    [Measures].[Employee Hours %]
    } ON COLUMNS,
    NON EMPTY CROSSJOIN(
    [Selected Departments],
    [Employee].[Employee Bill Rate].[Employee Bill Rate].ALLMEMBERS,
    [Employee].[Employee Level].[Employee Level].ALLMEMBERS,
    [TTM]) ,
    FILTER ([Employee].[Manager Name].[Manager Name].Members ,
    NOT InStr([Employee].[Manager Name].CurrentMember.MEMBER_NAME, "O-Tern"))
    If I remove the filter statement from this query and run it WITH the same parameters it runs fine - and has been running fine for literally over a year. The introduction of this FILTER statement is causing an issue.
    So either the filter is in the wrong place or it's not formed properly.
    I can provide a couple of examples of queries that are the ecact same with parameters and run fine, and when a FILTER is introduced they still run fine.
    A. M. Robinson

  • Filter Function problems on ALV report. [Resolved]

    Hi,
    I developed an ALV report by using function as below:
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM = G_REPID
    *            I_CALLBACK_PF_STATUS_SET = status_set
    *            I_CALLBACK_USER_COMMAND  = USER_COMMAND
                  I_STRUCTURE_NAME = 'T_BSIK'
                  IS_LAYOUT        = GS_LAYOUT
                  IT_FIELDCAT      = GT_FIELDCAT[]
             TABLES
                  T_OUTTAB    = TAB_BSIK.
    And this ALV custom report is referenced from standard function FBL5N.
    After i completed this report, i made an comparision of FBL5N and my custom report.
    When I apply the filter function, for example, on the document type, I cannot input 2 characters in the document type field under the filter function. The field length is only 1 character. Similar case results on the field document date.
    While the standard function FBL5N works very nice.
    What should i do to make the filter function of my own ALV report as the same as the standard function FBL5N do?
    Thanks in advance.
    Lala
    Message was edited by:
            Hoo lala

    Oh, i found where the problem is...
    add below 2 statements, then the question is resolved.
      LS_FIELDCAT-ref_fieldname = ****
      LS_FIELDCAT-ref_tabname = ***
    FORM FIELDCAT_INIT tables RT_FIELDCAT.
    CLEAR LS_FIELDCAT.
      LS_FIELDCAT-COL_POS   =  3.
      LS_FIELDCAT-FIELDNAME = 'BLART'.
      LS_FIELDCAT-TABNAME   = 'TAB_BSIK'.
      LS_FIELDCAT-SELTEXT_L = 'Document Type'.
      LS_FIELDCAT-ref_fieldname = 'BLART'.
      LS_FIELDCAT-ref_tabname = 'BSIK'.
      APPEND LS_FIELDCAT TO  RT_FIELDCAT.
    endform.
    Fine now.
    Lala

  • About the filter function in OBIEE 11g

    Hi, all.
    when i use the filter function in OBIEE 11g, it turn out a wrong result.
    The operation steps and detail are described as follow:
    1. In the Column Formula pane, I typed the Formula of the column 'count of customer' as:
    FILTER(count(distinct("customer info dimesion"."customerID")) USING ("TradeType Dimesion"."TradeType" = '001'))
    2. But the phisical SQL about this column in the NQquery file is that: "count(distinct(T11520.CUSTOMERID)) as c5, "
    which means that, the filter wasn't applied, right?
    If so, what shall I do in this situation, in other words , how can i make a Condition COUNT?
    Any Suggestion is appreciated!
    Thank you in advance~~O(∩_∩)O~

    Hi katherine,
    FILTER(count(distinct("customer info dimesion"."customerID")) USING ("TradeType Dimesion"."TradeType" = '001'))I think your formula there is mistake like many braces...instead type this in your f(x)
    =>Filter(count(distinct customer_id) USING trade type='001')
    This filter function is same like a case statement,if you filter still gives error write a case statement
    CASE WHEN TradeType Dimesion.TradeType='001' THEN count(distinct customer info dimesion.customerID) ELSE 0 END
    Will it be helpful?,follow this etiquette http://forums.oracle.com/forums/ann.jspa?annID=939
    By,
    KK

  • "Syntax error in the MDX statement " in Process chain failure??Urgent pls

    Hi Experts,
    could any one suggest me the procedure to rectify the below problems in process chain?
    1."Syntax error in the MDX statement "
    2."Error when getting data (Error when getting data (AXI))"
    Rgds,
    BH

    In which case it'll be that Access has a different date format to MySQL, and you're trying to push the string "'25-Apr-12 10:55 PM" into Access, which it's not understanding. To get around this, you need to treat your variable as a true date/time object, rather than a formatted string.
    CFQueryParams should be used on absolutely every database platform, they'll stop your website being vulnerable to SQL Injection attacks for one, which at the moment you're wide open to. Replace your query with something like this:
    <cfquery name="input_comments" datasource="#DSN#" username="#DSNUSER#" password="#DSNPASS#">
          INSERT INTO comments(
                             commenter,
                             comment,
                             datetime,
                             post_id
                   VALUES(
                             <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.commenter#" />,
                             <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.comment#" />,
                             now(),
                             <cfqueryparam cfsqltype="cf_sql_numeric" value="#form.post_id#" /> )
    </cfquery>
    The QueryParams will handle the data types for you, and should pass values around more safely and with fewer issues. Assuming you just want to store the current date and time you don't even need to get ColdFusion involved, as databases have their own functions for this. I believe Access' version is simply NOW(), so I've put that in your query.
    Give the above a go.

  • Non Empty function in MDX with IIF command

    Hi All ,
    I have a MDX query like:
    IIF(isgeneration([YEAR].CurrentMember, 2),
    iif(isgeneration([TIME].CurrentMember, 4),
    parallelperiod(YEAR.generations(2), 1, [YEAR].currentmember),
    missing
    missing
    Now if I'm trying to write NON EMPTY function like:
    IIF(isgeneration([YEAR].CurrentMember, 2),
    iif(isgeneration([TIME].CurrentMember, 4),
    +NON EMPTY(parallelperiod(YEAR.generations(2), 1, [YEAR].currentmember))+,
    missing
    missing
    then it gives me syntax error.
    Can you please help me how to write NON EMPTY function with IIF statement
    Thanks in advance

    Hi All,
    Any help Please. I'm getting error not only within IIF statement but also in simple MDX query. As a example :
    NonEmptySubset(
    ([Total Rev Measure], time.currentmember)
    This also thrown syntax error. I have tried Non Empty also.

  • Filter Function

    Hi
    I am trying to use the filter function in my Report Filters.
    Below is my SQL statement in the report filter but it throws an error that Filter needs an aggregate measure in the first expression.
    Finance.Date = FILTER(Max(Finance.date) USING ABC."Report Period" = 'Daily" AND DEF."Region"="NA")
    Is there something that I am missing here.
    The requirement is to match the date with the max date using the conditions mentioned above in the filter function.
    Any help will be greatly appreciated.
    Exact Error: State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 22038] Function FILTER requires at least one measure attribute in its first argument. (HY000)
    Edited by: vjbez1 on Nov 14, 2012 6:34 AM

    Hi,
    Could you please help me with how I can use the conditions on (MAX(Finance.date)) in the filter by converting to SQL.
    what I mean is, Max(Finance.date) where xxx=yyy and eee=uuu How to write this condition?

  • MDX Statement for TopCountin UniverseDesigner

    Hi together,
    I'm trying to build a TOP N function in a WebIntelligence Document. In a SAP BW Query I've created a formula variable.
    For example the User enters 5 for the variable, so I want to show the TOP 5 of one keyfigure.
    IN SAP BW i can use the condition in the Query to SOLVE it.
    Universes in SAP BO / WebIntelligence doesn't use conditions from the query.
    Can anyone help me to build a MDX-Statement in the Universe Designer to get the TOP N of a keyfigure.
    Thanks a lot!
    Kind regards
    Lars

    Hi Ingo,
    thanks for your fast reply.
    I found the document and I think I'm near a solution.
    My current MDX statement generated from the universe is:
    WITH MEMBER [Measures].[24145E65-73A0-DF11-85,88,14,60,A,C,0,0] AS
    TOPCOUNT([0ME_MED_ISS].[LEVEL01].members,3,Measures].[26SDIBEB571NMBEOG191RX7OO])
    SELECT  {[Measures].[26SDIBEB571NMBEOG191RX7OO],  [Measures].[24145E65-73A0-DF11-85,88,14,60,A,C,0,0],
        [Measures].[EQAO129PIC9UWXOJ2W2KRLANC] }  ON COLUMNS ,
    NON EMPTY UNORDER( {[0DIVISION].DEFAULTMEMBER} )  ON ROWS
    FROM [ZSDAMP004/ZSDAMP004_S004]
    SAP VARIABLES [Z1PME003] INCLUDING [0DIVISION].[40] [Z1PME003] INCLUDING [0DIVISION].[22] [Z1PME003]
    INCLUDING [0DIVISION].[21] [Z1PME003] INCLUDING [0DIVISION].[20] [Z1PME003]
    INCLUDING [0DIVISION].[00] [Z1PEI036] INCLUDING [0PLANT].[9010] [Z1PIN030]
    INCLUDING [0CALMONTH].[200906] : [0CALMONTH].[201008]
    [ZFV010] INCLUDING 2
    The Problem is the  Statement:
    WITH MEMBER [Measures].[24145E65-73A0-DF11-85,88,14,60,A,C,0,0] AS
    TOPCOUNT([0ME_MED_ISS].[LEVEL01].members,3,[Measures].[26SDIBEB571NMBEOG191RX7OO])
    if I use the statement in the one above and use the transaction mdxtest in bw:
    WITH MEMBER [Measures].[24145E65-73A0-DF11-85,88,14,60,A,C,0,0] AS 1 it works fine.
    My declaration in the univese for the TOPCOUNT is:
    <EXPRESSION>TOPCOUNT([0ME_MED_ISS].[LEVEL01],3,[Measures].[26SDIBEB571NMBEOG191RX7OO])</EXPRESSION>
    The Error for the statement is: "Invalid MDX command with ,"
    Thanks a lot.
    Lars
    Edited by: Lars Ohm on Aug 5, 2010 12:32 PM

  • SAP MDX statement size limit ???

    Hi all,
    we are developing complex stuff with MDX and now the question comes up, if there is any limit in the MDX statement size in SAP Abap world. The main handler classes are CL_RSR_MDX_COMMAND, CL_RSR_MDX_OLAP_REQUEST does anyone here know if there is a limit in the MDX statement size ???
    Thx a lot !

    Not sure on the MDX but from a OLAP statement point of view - a straight SQL against an Oracle tablehas a limit of 32k and in unicode 64k
    I am seeing some interesting scenarios when SQLs are fired through the application and not direct..
    A select with multiple in clauses will first try and do a between on the SIDs - if that fails it will build an in clause..
    On the phsical level the SQL is partitioned up and fired mutliple times (obviously to get aroudn the 32k/64k limit)
    However in a virtual cube scenario - a function module can only call 200-250 (hard coded!) statements on an in clause - you can override this but risk a database error on too long a SQL statement..
    THis may or may not help.. but it's all background

  • SQL Expression in decode function or case statement?

    Can I put SQL expressions in decode function or case statement?
    For example,
    select le.profile, decode( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile, 0, 'N', 'Y')
    from element le;
    or
    select le.profile, case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0 THEN 'N'
    ELSE 'Y'
    from element le;
    None of the above work.
    Can anyone tell me how to make it work?
    Is there any workaround?
    Thanks,
    J

    You simply needed and END to your CASE statement;
    SQL> with profile_data as (
       select 'XXXX_AFTER' name, 1 object_id from dual),
         element as (
       select 1 profile from dual union all
       select 2 from dual)
    select le.profile,
       case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0
       THEN 'N'
       ELSE 'Y'
       END new_col
    from element le
       PROFILE N
             1 Y
             2 N

  • Filter Function in Column Formula is not working properly

    Hi,
    I am using Filter Function in Column formula tab in Answers to calculate the Total sum from the start of the Fiscal month to the Month selected from the Prompt.
    My requirement is I have total sales column. Now I need to calculate TYYTD kind of thing for which I cant use the Time sereis due to my report constraint.
    Instead of that I am using this Filter function on TYYTD column where i am giving the filter as start of the Fiscal month to the month selected from the Prompt.
    For example if I select May month from the Prompt then this TYYTD column should give me SUM(Total Sales) between Feb and May for which I am using the Filter Function. But it giving me only May sales whcih is same as Total Sales column.
    Can anyone throw some light on this as this is very important for us or any alternate solution other than Time sereis measures.
    Did anyone got this kind of issue with Filter Function?
    Regards,
    Azad

    Ok...here's the steps to fix this as efficiently as possible.  I have a whole bunch of mailboxes under "On My Mac" and they have a bunch of mailboxes nested in them.  I get my messages into Apple Mail via IMAP.  (I don't know if this matters.)  The steps below assume you have a similar setup.
    1.  Hold the Option key down and click the dropdown arrow next to each mailbox that has one.  This will cause all nested mailboxes below it to appear.
    2.  Go to the top of the list of mailboxes under "On My Mac" and highlight the first mailbox.  Then hold the Shift key down and highlight the last mailbox in the list.  This will cause all of the mailboxes and nested mailboxes to be highlighted.
    3.  From the menu, select "Mailbox --> Rebuild" and the rebuild process will start.
    4.  Watch the top of the mail screen to see the message count change as the mailboxes are being rebuilt.  Wait until the activity stops before doing the next step.
    5.  As the mailboxes were rebuilt, many messages were reset as "Unread" even though every message was previously "Read."  Make sure the mailboxes you want to affect are still highlighted.  Right-click and select "Mark All Messages Read."
    That fixed the problem for me.

  • How can I get  the MDX-statement which is generated in a query?

    Can I somehow get the MDX statement, which is generated when I create a Query via BeX Query Designer? I am using JCo to connect to BW (3.0b) and to execute MDX statements from a standalone JAVA-application. It would be very helpful to have the statements, so that I don't have to create them by myself.
    If this it not possible...is there any reference regarding the MDX statements, I could use?

    Hi Markus,
    The Query Designer generates no MDX, so you can't find any persisted MDX Statements. But you can do a trick, you can use the SAP BW OLE DB Provider in Excel. This Tool generates MDX Statements check this link:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/a06a51f3-0201-0010-8591-b742cfafd267
    I hope this helps.
    best regards
    Kai

  • How can i extend the filter function to also include an option to select which column to filter on?

    Hi.
    I have built an spry test-page (testing it on my localhost  so i cannot give you direct access to it) here i have an XML file that i show in an dynamic/ repeat table with 5 columns.
    I hvae included an spry filter function to easy filter out records, but the code only allows me to filter on one of the columns.
    I would like to add an extra "select-menu" to define which column the filter should be active for, how can i do that
    Here is the filter code and also the html code for the select-menu and the box to type in what to filter.
    The bold parts is the important parts, i would like the options values from the select menu to be inserted in the filterData function to be able to define which column to do the filtering on.
    var ds1 = new Spry.Data.XMLDataSet("report3.xml", "orders/order", {sortOnLoad: "@id", sortOrderOnLoad: "descending"});
    ds1.setColumnType("date", "date");
    ds1.setColumnType("BUTIKNR", "number");
    ds1.setColumnType("EXTRAFRAKT", "number");
    ds1.setColumnType("job/@idx", "number");
    var jobs = new Spry.Data.NestedXMLDataSet(ds1, "job");
    function FilterData()
        var tf = document.getElementById("filterTF");
        var menu = document.getElementById("searchIdent");
        if (!tf.value)
            // If the text field is empty, remove any filter
            // that is set on the data set.
            ds1.filter(null);
            return;
        // Set a filter on the data set that matches any row
        // that begins with the string in the text field.
        var regExpStr = tf.value;
        if (!document.getElementById("containsCB").checked)
            regExpStr = "^" + regExpStr;
        var regExp = new RegExp(regExpStr, "i");
        var filterFunc = function(ds, row, rowNumber)
            var str = row["@id"];
            if (str && str.search(regExp) != -1)
                return row;
            return null;
        ds1.filter(filterFunc);
    function StartFilterTimer()
        if (StartFilterTimer.timerID)
            clearTimeout(StartFilterTimer.timerID);
        StartFilterTimer.timerID = setTimeout(function() { StartFilterTimer.timerID = null; FilterData(); }, 100);
    html:
                <select name="searchIdent" size="1" id="searchIdent">
                    <option value="@id" selected="selected">ID</option>
                    <option value="date">DATUM</option>
                    <option value="time">TID</option>
                    <option value="BUTIKNR">BUTIK</option>
                    <option value="REF">REFERENS</option>
                  </select>
              <input type="text" id="filterTF" onkeyup="StartFilterTimer();" />
    Contains:
      <input type="checkbox" id="containsCB" /></td>
    Thanks in advance.
    //Rickard H

    Now it works, i had to do it like this:
        var filterFunc = function(ds, row, rowNumber)
            var str = row["@id"];
            if (str && str.search(regExp) != -1)
                return row;
            var str1 = row["date"];
            if (str1 && str1.search(regExp) != -1)
                return row;
            var str2 = row["time"];
            if (str2 && str2.search(regExp) != -1)
                return row;
            var str3 = row["BUTIKNR"];
            if (str3 && str3.search(regExp) != -1)
                return row;
            var str4 = row["REF"];
            if (str4 && str4.search(regExp) != -1)
                return row;
            return null;
    I also had to remove the line "ds1.setColumnType("BUTIKNR", "number");" from the code, otherwise it would not search at all (only searches string types?).

  • Using FILTER function in oracle answers

    Gurus,
    I have a question related to using Filter function in oracle answers.
    When trying to insert a Filter (expr) Using (expr) clause in the formula area of a fact table field, It errored out with msg saying about using a wrong measure.
    I know this can be done with a case expression but I tried filter clause since this is available in oracle answers.
    Please help me figuring out this scenario.
    Thanks.

    David / Raghu - Thanks for u'r replies and apologizes for not posting question with proper material.
    Am posting my code and the error message from the screen.
    Code :
    IFNULL(FILTER("Fact - MBS Loan Transactions"."OUTSTANDING PRINCIPAL" USING "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK" = 'HDC'),0)
    Error :
    nQSError: 10058] A general error has occurred. [nQSError: 22032] Function FILTER requires at least one measure attribute in its first argument. (HY000)
    SQL Issued: SELECT "Dim - MBS Loan"."LOAN AMOUNT", "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK", "Dim - MBS Loan"."LOAN TYPE SEN/SUB", "Dim - MBS Project"."PROJECT NAME", "Dim - MBS Project"."PROJECT NUMBER", "Fact - MBS Loan Transactions"."AR BALANCE INTEREST", "Fact - MBS Loan Transactions"."GL BALANCE INTEREST", IFNULL(FILTER("Fact - MBS Loan Transactions"."OUTSTANDING PRINCIPAL" USING "Dim - MBS Loan"."LOAN TYPE HPD/HDC/BNK" = 'HDC'),0) FROM "Financials - MBS"
    OK (Ignore Error)
    Please continue answering my queries. Since am a newbie your answers won't be just a reply but it's actually learning for me.
    Thanks.

  • PL/SQL Function in Select statement

    Hi
    I am calling a function in select statement. The query works in Toad and PL/SQL developer except SQL plus and disconnecting Oracle connection.
    The error is “ERROR at line 1: ORA-03113: end-of-file on communication channel”.
    When I called the same query from BC4J View Object the error message is “java.sql.SQLException: No more data to read from socket”.
    Can any one advise me please?
    Thanks
    Srini

    Srini
    I've seen similar cases in the past with 9.2.0.x (x <= 5). What Oracle version are you using? It's worth checking the bug database (I can't just now - I don't have a valid support id in my current contract). And as Warren says, post your SQL query.
    HTH
    Regards nigel

Maybe you are looking for

  • Problem about ExtensionFileFilter

    whats wrong with my code? please have a look at it. import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.util.zip.*; import javax.swing.*; import javax.swing.filechooser.FileFilter; public class ZipTest {     

  • T code for sales ageing report plant wise

    Is there any standard report to sales ageing report plant wise & material wise. Pls guide me with the

  • Correct values for DefaultExportPath option in Disco pref.txt file

    Hi All, I am trying to edit the "DefaultExportPath" parameter in Disco pref.txt file file. We are using Discoverer Plus and Viewer on CP4 and are using JVM1.5 or higher. I referred to Metalink Doc Id: 365245.1 and Oracle Configuration Guide doc B1391

  • Need JNLP Server Implementation

    I'm using WebStart to deploy a Swing based application on a classified network. I want to use some of the advanced features such as automatic JRE version deployment but I can't get to Sun's site to use their JNLP server because I'm on a closed networ

  • Always having to switch users

    I'm fairly new here and have my site up and running but I do have a nagging problem: If I close iweb then reopen, it won't let me publish any changes. Gives me the "can't find server..try later" drop-down. I have done all the things I found on this h