How to consider only values 0 when calculating Averages

Hi,
Currently, I am using Avg (table.column) function to caluclate averages. However, one of our user wants to only consider records that are >0 when calculating averages. For example if a result set as 10 records, and only 2 of them has values >0 then typically Avg function would caculate based on (sum of 10 records/10). But per our user's requirement, he wants to consider (sum of 2 records/2) and ignore the remaining 8.
Can you please tell me how to do achieve this?

I found the solution after much deliberatiion myself :-). I used the following formula instead of the AVG function and it worked.
Note that "Fact - +fact name+".column is a numeric column and can have null values.
SUM(IFNULL("Fact - +fact name+".column, 0)) / COUNT("Fact - +fact name+".column)

Similar Messages

  • Xml: how to get node value when pasing node name as a parameter

    Hi,
    I've got some xml:
    var xmlData:XML =
    <1stNode>
        <buttonID>first child node value</buttonID>
        <imageID>second child node value</imageID>
        <labelID>third child node value</labelID>
    </1stNode>
    Then I want to read specific node value based on a value passed to a function. .
    var buttonID = new Button;
    var imageID = new Image;
    var labelID = new Label;
    getNodeValue(buttonID); //the value here is set dynamically
    private function getNodeValue (nodeName:String):void {
    trace (xmlData.nodeName)                      //doesn't work
    var str:String = "xmlData." + nodeName;
    var xml:XMLList = str as XMLList             //doesn't work
    I'm don't know how to get the value when node name is dynamically changed.

    use:
    getNodeValue(buttonID); //the value here is set dynamically
    private function getNodeValue (nodeName:String):void {
    trace (xmlData[nodeName])                    

  • How to set setRowKey value when table is populated dynamically

    Hi All
    I have created a view object using only select statement and displaying all the records in it in the table at page load. Table is SelectMany. Now after selecting some records I press submit button. At the backend logic is executed which prints how many rows selected and the values of the selected rows. Everything works fine till here.
    Now when the view object is modified by putting where clause. And the parameter to this where clause is coming from url. When the page is loaded table displays only records based on filter criteria. But the problem begins when I press the submit button. It shows the error: row is null for rowKey:oracle.jbo.Key[AAAQkHAAJAAAACkAAA ]
    I have done some research and found that row key is not set for the displayed records. because at the backend when I am printing the values of keys in selectionState.KeySet it prints only null.
    This thing happens only when table is populated dynamically through url value.
    Can anyone help me how to get the selectionState.Keyset values when table is populated dynamically?

    SOLVED:
    Actually there is no problem with the rowKeys as I mentioned in the post. What happened was that I was executing the query everytime on page load. Second time when the page is loaded the param value was set to null. So row becomes null but on the other hand I am referring the rows by some selected row keys. so the error that row is null for key...
    So now i am storing the param value in managed bean and then referring it in the code.

  • How to Get checkbox value when List value changed in classic report

    hi ,
    i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
    take value of checkbox item and show it in message .
    SQL for report
    SELECT
    '<INPUT TYPE="checkbox" NAME="f01" VALUE="'
    ||SEQ
    ||'">' SEQ,
    ID,
    DEPT_NO,
    EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
    now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
    i create JavaScript on the page
    function test(pThis) {
    var f01_value = $('select[name="f01"]').value;
    alert('#SEQ : '+ f01_value);
    </script>
    I call this javascript function when list change but the value undefined..
    My Question :
    How can get this value Or any value of item in reports
    regards
    Ahmed

    Hi Ahmed,
    >
    i worked with apex 4.2 and i create normal classic report with one checkbox column and one column change it to select list(named loved) now i want when user change list
    take value of checkbox item and show it in message .
    SQL for report
    SELECT
    '<INPUT TYPE="checkbox" NAME="f01" VALUE="'
    ||SEQ
    ||'">' SEQ,
    ID,
    DEPT_NO,
    EMP_NAME} i change the column attributes of Dept_NO to Display as Select list of department name (named lov).
    >
    You should not create checkboxes like this. Either use the APEX_ITEM.CHECKBOX2 API or change the Column Type to Simple Checkbox.
    >
    now i want when user change name of department the value of SEQ SHOW IN ALERT MESSAGE
    i create JavaScript on the page
    function test(pThis) {
    var f01_value = $('select[name="f01"]').value;
    alert('#SEQ : '+ f01_value);
    </script>
    >
    name="f01" returns an array, what you need is single element value.
    Try
    <script type="text/javascript>
    function test(pThis) {
      var f01_value = $v(pThis);
       alert('#SEQ : '+ f01_value);
    </script>
    {code}
    {quote}
    I call this javascript function when list change but the value undefined..
    My Question :
    How can get this value Or any value of item in reports
    {quote}
    Depends in how you are invoking/triggering the change event. Are you using DA or have you written an "onchange" event on the element?
    Cheers,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to set item values when redirecting to the same page.

    I just created a redirect button that I want to redirect to the same page and set the 2 page items on the page to the same value they had before the redirect.
    But I can't write:
    Set These Items: P1_Permit_Number,P1_Fishing_Year
    With These Values: &P1_Permit_Number.,&P1_Fishing_Year.
    Because there are no values in the session state, since a submit has not been done.
    So how do I do this?
    I know how to get the values stored in the items, e.g., $v('P1_PERMIT_NUMBER')
    but where do I place that command? It's not allowed under "With These Values"
    And I don't really want to make this a submit button and create a process that says:
    P1_PERMIT_NUMBER := $v('P1_PERMIT_NUMBER') because that would complicate the page too much -- I already have other processes and branches on the pages whose conditions would have to be modified so that they don't run during this scenario.
    Thanks.

    Thanks Gary and Andy. I rewrote the function according to above instructions:
    function redirectToURL()
    var permitNumber = document.getElementById('P1_Permit_Number');
    var fishingYear = document.getElementById('P1_Fishing_Year');
    var url = 'f?p=&APP_ID.:1:&APP_SESSION.::::P1_Permit_Number,P1_Fishing_Year:' + permitNumber +',' + fishingYear;
    window.location.href = url;
    But when I entered a value for permit number and fishing year and redirected, the word "null" appeared in the Permit page item, instead of the permit number that I had entered.
    Remember that I am not submitting here. So if the syntax you showed me, i.e. getElementById('P1_Permit_Number'), searches for the item's session state, then it will be wrong, since there is no session state value for the items at this point. Perhaps that is the reason I got the null?
    If so, what can I do?

  • How to set a value when right click on af:commandlink ?

    Hi All,
    JDev Ver : 11.1.1.4.0
    How to set a value to property listener on right click of a commandLink ?
    I am having values that are hyper linked using af:commandlink, when i right click on hyperlink, that value i need to get in the managed bean ?
    (While right click i am populating on menu item)
    how to get the value ?
    Give some solutions ?
    thanks
    Gopinath

    Hi,
    Try this code:
    <af:clientListener method="rightClick"
    type="contextMenu"/>
    <af:serverListener type="setValue"
    method="#{beanName.setValueMethodName}"/>
    <trh:script xmlns:trh="http://myfaces.apache.org/trinidad/html"
    id="s13">rightClick = function(event) {
    var source = event.getSource();
    AdfCustomEvent.queue( source, "setValue"
    , {}, false); }
    </trh:script>

  • How to add default values when adding custom component to design view?

    I have a set of custom components (usually) extending Spark components. But when adding our custom component onto design view, how can I define defult values (in AS3).
    For example, s:Button has default label = 'Button' when added to application, or mx:DataGrid has 3 columns predefined, but when using custom components there are no predefined values like this.
    I can put this values in constructor, but they are not visible in design time, only runtime.
    Any ideas? Thanks
    Esmin

    yes, I am. By the way I've found the solution. Someone might find this usefull.
    In design.xml having
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput"/>
    use this
    <component name="ExtendedTextInput" namespace="mynamespace" category="beta" displayName="ExtendedTextInput">
            <defaultAttribute name="text" value="ExtendedTextInput"/>
        </component>
    so when adding this component to design view, it will have text setted to value ('ExtendedTextInput' in this case).

  • How to Get the value when clicking on the link

    I had a problem with when clicking on the link.
    I need get the link value to the controller when clicking on the link.
    I am displaying the database columns in jsp using repeater in links.
    I am displaying the data like this:
    RED
    BLUE
    GREEN
    these are three links.when clicking on the link RED. RED should go to the controller.
    After getting RED to the controller i will get the RED value from the database.

    my requirement is like that only
    I have just given the example of emp and dept
    emp(empno,zone_group_id,zone_id,deptno,ename,emp_p_ind,last_update_datetime);
    dept_emp(empno,dept_no,loc,dname,sal_emp,grade,last_update_datetime);
    CREATE OR REPLACE VIEW emp_zone AS
    SELECT e.empno,
          (select zone_group_id from price_zone_group where rownum = 1) zone_group_id,
           d.loc zone_id,    
           d.grade,  
           d.last_update_datetime,
      FROM dept_emp d
          emp e
    WHERE d.empno=e.empno
       AND e.emp_p_ind = 'Y'
      WITH READ ONLY;
    Now
    my requirement is to get the data of emp_zone view and needs to store those data into some other temp table
    if any of the above base table got updated deleted or inserted then the view last_updatetime also will get updated but problem is why im not using base table
    direct because it is having huge data and it performance issue .i have to get the value on the basis of view only and using some logic

  • How can i get value when the field name is user's defined

    Hi,
    I have a one java method:
    public ResultSet countUserDb(String id) {
    ResultSet rs = null;
    con = dbcon.connect();
    String queryString = ("select count as count from
    db_allocation where user_id='"+id+"'");
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    When i call it in a jsp file.
    ResultSet counter =db.countUserDb(request.getParameter("id"));
    if(counter.next())
    int x=rs.getInt("count");
    Tomcat said incorrect column name.How can i get the result set when the field name is user's defined.
    Best regards
    Ricky

    You should give the user defined name in the ResultSet.getXXX method to retrieve the column value.
    Example
    SQL:
    Select ename as employeename from emp;
    You should say :
    ResultSet.getString("employeename"); to get the value.
    Alternatively you can retrieve it using column number:
    ResultSet.getString(1);
    Chandar

  • How to get  correct values when  ever iam looking restirict

    hi,
    i have sales obejct and also having text. when ever i have checked in se16 . it has showing like 1, 2, 33....etc. but  when ever iam  looking to restrict sales obeject with some value . but idid't see the alll values . what ever there in SE16.
    plz  let me know . what is problem . i was facing same problem in web report also.
    regards,
    Murali

    Murali,
       If you mean in BEx.....while restricting at the bottom of the restriction box you will see 100 number which means only 100 values are shown. Besides that 100 you have a arrow pointing towards right. press that and you will get another dialog selection condition. In that select for 'No of values displayed' as 'ALL". This will show you all eth values while restricting.
    Hope this helps you....

  • How to save only master when detail is blank.

    In master-detail can I use getTransaction().commit(); for only master because I finish only master not yet to keyin detail.
    How to do.
    Thank you very much.

    commit() while save all pending changes, so when you haven't entered the details, it will only save the master row I guess.

  • How to get MessageTextInput Value when rendered property is set to false.

    Hi
    Is there any way wherein i can get the value of the data populated in the messageTextInput field which has it's rendered property set to false.When I use pagecontext.getParameter("textboxname"),i can fetch the value at the time of LOV event..but once my lov event is done and I hit the go button,pagecontext.getParameter("textboxname"), returns me null.
    Can anyone suggest me how can I track the value?
    Thanks
    Puja

    Setting rendered to false would make the bean not to be available in the HTML so you cannot do a getParameter on the bean.
    if you want to read a value that is like a hidden field, try using formValueBean instead.
    Thanks
    Tapash

  • How to show NULL value when import data into excel

    when retrieve data from sql server and import these data into excel.
    data source  is like : select a ,b c from tab
    if a,b,c is nullable. when import these NULL value into excel, it becomes blank value, there is nothing in the excel cell.
    if i don't want to use select isnull(a,'NULL') as a to convert the values.
    what's else can i do to make it? is there a way to prevent changing the NULL to blank ?
    or is there an easy solution to replace all the blank value to NULL in the excel ?

    help me ~

  • How to filter compounding value when no data available for that field.

    Hi experts,
    I have a compounding value (Logical Procurement System) for an infoobject username which shows up in Bex when no data is available for that row. It shows up like this "compounding value/not assigned" instead of just "not assigned". I have put the compounding infoobject in the filter area and restricted that value/set to no display. still the compunding key/xxxxxxx. shows up. Any thoughts to fix this issue is appreciated.
    I looked into SDN threads..but no help. This issue is stopping me from moving reports to production.
    Let me know if you need any information in this regards.
    Thanks,
    SAPBWI

    Hi,
    Please add this compunding char in free char.Do not set it to no display
    -Vikram

  • How to decrease timeout value when there is no response from BOE server?

    We are using BOE XI R2 .NET SDK to logon BOE XI R2 Server as below as well as using Infoview/CMC logon BOE:
    set boSessionManager = Server.CreateObject("CrystalEnterprise.SessionMgr")
    set boEnterpriseSession = boSessionManager.Logon(boUserID, boPassword, boCMS, boAuthType)
    There is no response for long time from BOE server after I excuting log on BOE using .NET SDK or Infoview/CMC App for more than one minute.
    So I want to timeout the logon atction after a certain time such as one minute if there is no response from BOE server.
    My question comes:
    1. What is the default timeout value for this operation?
        Where can I find it and how to modify it?
    2. I found ther are some registry keys on .NET APP Server:
        HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\InprocServer\EnterpriseRequestTimeout
        HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Report Application Server\Client SDK\CorbaAdapter\WaitReplyTimeout
    Are they for the action timeout I mentioned above? If not, what do they work for?
    It seems that WaitReplyTimeout is for report data retrieval timeout according to Kbase article 1199286 and which registry setting to change for long running reports, is it correct?
    Thanks for any response.
    Thanks,
    Sunny

    I don't think there is a setting available for this.  The timeouts you are looking at are essentially how long to wait for a report to process.
    My concern about trying to find a setting like this is that if you do get the client (aka SDK) to timeout after one minute, the CMS may still recieve this request shortly after and logon, creating a session that no longer has a handle to it and will then have to wait for it to timeout because of inactivity which would tie up a license.

Maybe you are looking for

  • SQL Developer 3.x Disconnection Problem

    We are running SQL Developer 3.1 on Windows 7 64 and connecting to a 11.2.0.3 database. The user's can connect fine, then they can click through and see their tables. Once they click on the tables to see the columns or data, we immediately get discon

  • StarOffice 8 CDE Icon and Document File Extension Associations

    I recently upgraded to Solaris 10 (5/08). With previous versions of Solaris, I installed StarOffice 7 from CD and it placed the nice little icon in the CDE desktop panel and it created StarOffice associations to all the typical office file extensions

  • Advantages of QT over Flash Video?

    I am of the opinion that from experience Quicktime is the best codec system available by far. However when dealing with some clients re video for their sites they state that according to their webmasters flash video is sufficient. Another argument pu

  • How do you create a structured numbering system in mac "pages".

    I used to use microsoft word, but said id give "pages" a go. what im looking to do is to create a structured report, with the headings in the following manner e.g. 1.0      1.1      1.2      1.3           1.3.1           1.3.2           1.3.3      1.

  • A "replacement" phone has been shipped...will it be a new iphone 4?

    i recently sent my iphone 4 to apple's repair facility and i was just notified that my iphone 4 could not be repaired so they are sending me a "replacement" phone.  will i get a new phone? thanks all.