Dividing the two calculated fields

Hi people,
I am able to divide two calculated fields viz (# opportunities created / # opportunities Won) but I want to display "0.00" when the numerator and the denominator are '0 '.
The calculation that I use is

1.0 * (COUNT (DISTINCT BOX WHEN opportunity. "Created Date" "< = CURRENT_DATE AND opportunity. '" Created Date' > = TIMESTAMPADD (SQL_TSI_DAY-30, CURRENT_DATE) THEN opportunity. ("' Opportunity ID ' NULL OTHER END) / COUNT (DISTINCT BOX WHEN opportunity. "Stage of current sales' = ' Closed / Won" AND opportunity.' " Modified by time"< = CURRENT_DATE AND opportunity. "" Modified by DateTime "> = TIMESTAMPADD (SQL_TSI_DAY-30, CURRENT_DATE) THEN opportunity. ((' ' END of NULL OTHER opportunity ID '))

Any suggestions?


Thank you and best regards,
Amit Kul

Put a case when statement around it:
When case (DIVISIONS. VAL1/DIVISIONS. Val2) is null then 0 DIVISIONS on the other. VAL1/DIVISIONS. End Val2

concerning
John
http://obiee101.blogspot.com/

Tags: Business Intelligence

Similar Questions

  • Try to divide the two numeric fields and have response in the third field num

    Okay, I do something wrong and can not understand it.  I use the code below in the field of PSF of my form to divide two different fields digital and for the life of me I can't understand why it does not work.  I guess it's something simple.  I downloaded the form.  Please take a look at the form and me know where I am on leave.  You almost have something simple and I just don't see

    < activity = "click on" name = "event__click" >

    < script contentType = "application/x-javascript" >

    If (NumericField13.isNull |) NumericField13.rawValue == 0)

    {

    NumericField28.rawValue = '0 '.

    } elseif(NumericField27.isNull ||) NumericField27.rawValue == 0) {}

    NumericField28.rawValue = '0 '.

    } else {}

    NumericField28.rawValue = NumericField13.rawValue / NumericField27.rawValue;

    }

    < /script >

    < / event >

    I think it has something to do with the way which is made the division.  I think he's trying to divide by zero, although at this time I tried several different if/then instructions and can't see where I go into the equation, so I tried the above only a click again and could not get that to work either.

    Thanks in advance for your help.

    Justin

    First thing is that you have this script running on the click... event so that your code will not run until a user clicks on the field. I suggest that you put it

    the calculate event. In this way, every time one of the other values named in the formula change t

    hen she'll recalculate this field.

    Second, there was a script error in your formula... I modified to look like this (it seems just more logical that way to me)

    If (NumericField13.isNull |) NumericField13.rawValue == 0) {}
    NumericField28.rawValue = '0 '.
    } else {}
    if(NumericField27.IsNull ||) NumericField27.rawValue == 0) {}
    NumericField28.rawValue = '0 '.
    } else {}
    NumericField28.rawValue = NumericField13.rawValue / NumericField27.rawValue;
    }
    }

    Third, your shodul of NumericField27 have a default value 1 or you should make its value acheck so that she does not have a possibility to get a 0 or your division will fail.

    Finally, shodul you rename your fields have insstead of generic names like numericField XX more descriptive names. Many people like to know the type of field to the name then, instead of NumericField27 SQFT_NumFld what would you say? With this technique, I can say immeadiately field in which you speak (Square Footage) and its type (numeric). Just my 2 cents worth!

    Paul

  • How to divide the two numeric fields?

    Hello.

    I tried to divide two numeric fields, called A and B and put the result in a hidden field called C. I need the value for an XML export.

    My question is; How is it possible to divide A and B? I don't have a problem in multipling other areas, but trying to divide I get at most / overflow error.

    Best regards

    Mathias

    Hello

    During the distribution, please check that the value of the field as the line is not null or zero first. So the event calculate the hidden field would look something like this:

    if (b.rawValue == null || b.rawValue == 0)
    {
         c.rawValue = "0"; // If c is a numeric field. If it is a text field then you could put a message "division by zero"
    }
    else
    {
         c.rawValue = a.rawValue / b.rawValue;
    }
    

    Hope that helps,

    Niall

  • To access the two video fields of framing in the workspace?

    I'm new on video and have just learned there are two video frames / frame of the video.

    Is it possible to access the two video fields of the frame within the workspace of PP CS6?

    I work with dv 29.97 FPS.

    Thanks in advance.

    Thomas

    iMac Mac OS X 10.8.3 end of 2012

    Hi Thomas,

    If you ask if you can somehow "edit" on the ground, then no. But if you want to see full frame (combined fields), in the program monitor, do a right-click (or Mac equivalent) or there is a key it click on as well and in the drop-down list, look at the options of fields and set at a TIME rather than up or down.

    Thank you

    Jeff Pulera

    Safe Harbor computers

  • How to carve, and concatenate the two text fields in a form

    Hi people,

    Newbie here... have two fields in a form: FirstName and LastName.    Want to have these appear later as: name, first name.

    For example: 'Rick' "Stockstill" should later manifest as: 'Stockstill, Rick' with a comma separating the names and trailing blanks removed.

    It is a piece of cake in Excel, but have not figured out how to do the same with Acrobat.    My first try at a script looks like this:

    (Recipient.rawValue = trim (LastName.rawValue) +","+ FirstName.rawValue);

    The field 'Recipient' is a standard text field which I am filling using the property to 'calculate '.  The good news is that I get no error message, but the bad news is that the field recipient does not get filled.

    Any help is greatly appreciated.

    At the latest,
    Rick Stockstill
    North East Independent School District
    San Antonio, TX
    210-407-0317.
    [email protected]

    OK, in this case you can use this code as the custom recipient field calculation script:

    event.value = trim(this.getField("LastName").valueAsString) + ", " + trim(this.getField("FirstName").valueAsString);
    
    function trim(s) {
        return s.replace(/^\s+/,"").replace(/\s+$/,"");
    }
    
  • combines the two text fields

    Hello, I've created a form with Adobe pro XI. I want to create a text field that combines the two fields (Field1 and Field2) text. How can I do?

    If the third field does not need to be editable, you can use a calculation script customized to what is something like the following:

    Custom calculation script

    (function () {}

    Get the field values as strings

    var s1 = getField("Text1").valueAsString;

    var S2 = getField("Text2").valueAsString;

    Set the value of this field to the concatenation of two strings

    Event.Value = s1 + s2;

    })();

  • Is it possible to divide the two lines

    Hi all

    I have two rows in the given order and I wanted to divide.

    Rank last month number month
    1 19 16
    2 50 52


    How can I split 19/50 and 16/52?

    Thank you
    WITH t AS
         (SELECT 1 a, 19 last_month, 16 curr_month
            FROM DUAL
          UNION ALL
          SELECT 2, 50, 52
            FROM DUAL)
    SELECT c1 / c2, c3 / c4
      FROM (SELECT MIN (CASE
                           WHEN a = 1
                              THEN last_month
                        END) AS c1, MIN (CASE
                                            WHEN a = 2
                                               THEN last_month
                                         END) AS c2,
                   MIN (CASE
                           WHEN a = 1
                              THEN curr_month
                        END) AS c3, MIN (CASE
                                            WHEN a = 2
                                               THEN curr_month
                                         END) AS c4
              FROM t)
    

    Above it is only for your DataSet
    Try this... You can get a better solution of Frank

  • Check that the two signature fields are signed

    I want a subform to open only after the signature field is signed. I can't make it work. Here is my script:

     Form1.Subform18.Gate1CustSupApproval::docReady - (JavaScript, client)
    var oState = event.target.getField("Form1.Subform18.Gate1TeamLeaderApproval").signatureValidate();// && event.target.getField("Subform18.Gate1CustSupApproval").signatureValidate(); 
    if (oState != 0){
     Gate2.presence = "visible";
    }
    else
    {
     xfa.host.messageBox("You have not signed the form. \n\nPlease press OK to return to the form and then click the signature field to sign the form. \n\nThank you!", "Error submitting this form", 0, 0); 
    }
    

    It is not a good practice to hide content on a document when users apply a digital signature, are unwilling to sign a document that has a hidden content.

    If you don't want users to fill out certain fields in the subform, and then you can add validation checks in the event preSign of each signature field to ensure that - if the validation fails then cancel the signing operation.

  • Formula for dividing the three entries from field (D = A/B/C)

    I have a formula to get a value, and this is to divide the three entries from field. I don't know enough about javascript to correctly enter the code to make this happen. I have 20 rows in a form and I need to calculate column D I saw a thread on how to divide the two fields, but I need to go further with it. Can someone help me? I added that I was working (left) and I tried to develop (right).

    Internet Personal

    establish the variables for the names of fields for the dividend and the divisor.

    var sDividend = ' domain name my dividends. "

    var sDivisor = 'name of the My divisor field. "

    get the value of the divisor field

    var nDivisor = this.getField ("sDivisor") .value;

    get the value of the dividend field

    var nDividend = this.getField('sDividend').vlalue;

    do not modify the code under this line

    Clear the value of the result field

    Event.value = ";

    see if we have a divisor of zero

    If (nDivisor! = 0) {}

    We can then divide

    Event.Value = nDividend / nDivisor;

    } / / end of calculation of the division

    The above assumes that you are dividing the value of the 2 fields.

    Assignment of the variables

    var PW1 = "PlotWt1";

    var WBC1 = "WetbuConversion1";

    var AF1 = "Acre Factor1";

    Get the values

    var nPW1 = this.getField (PW1) .value;

    var nWBC1 = this.getField ("WBC1") .value;

    FNa1 var = this.getField (AF1) .value;

    Clear the value of the result field

    Event.Value ="";

    see if we have a divisor of zero

    If (nWBC1! = 0) {}

    //Actual division operation

    event.value = nPW1 / nWBC1 / FNa1;

    } / / end of the calculation of the division

    Change the line of code:

    If (nWBC1! = 0 & nAFN! = 0) {}

    If you want to use the same calculation for a number of lines, you can create a function that all calculated fields can use, but it depends on the names of the fields that you use. If you are simply changing the number at the end, the function might be:

    function calc1(num) {
    
        // Assigning the variables
        var PW = "PlotWt" + num;
        var WBC = "WetbuConversion" + num;
        var AF = "AcreFactor1" + num;
    
        // Getting the values
        var nPW = this.getField(PW).value;
        var nWBC = this.getField(WBC).value;
        var nAF = this.getField(AF).value;
    
        // clear the result field value
        event.value="";
    
        // see if we have a non-zero divisor
        if (nWBC !=0 && nAF != 0) {
            //Actual division operation
            event.value = nPW / nWBC / nAF;
        }
    
    }
    

    You can then call it in the custom calculation of the field as the script:

    Calc1 (1);  Rank 1

    For line #5, it would be:

    Calc1 (5);  Rank 5

    This could be simplified a bit if you have changed your domain naming scheme to make it easier to extract the line number. In this way, that you wouldn't have to pass as I showed.

    To create a script at the level of the document to place the function, select: Advanced > Document Processing > Document JavaScripts > Add

  • Tweaking of default query so that the two fields are searched equally

    I have a 'Customer Details' data block that contains the field "mobile1" and "mobile2" for customer's cell phone numbers. When a customer enters into a mobile number or a field, I need to check the two mobile fields to see if this number exist as the primary contact number or secondary to any client of the query.
    I've tried to set a default_where clause, but oracle automatically adds to him whenever a number is entered in the field, making me a little trouble at the head!

    For example, if I say something like, WHERE MOB1 =: BLOCK. MOB1 OR = MOB1: BLOCK. Mob 2 (do not question true, just one example)
    And I took #-# in the field of mobile2,.
    Forms adds to this "AND mob 2 =: 1'"

    which causes the query to return nothing, since there is no entry mob 2 is equal to the registered number, even if there is an entry MOB1 bearing the same number.

    Is there a way to change the AND a RC for the query?

    If not, can anyone suggest how I can get the result, I'm looking for without having to change my block to a block not DB and duplicate me all the default features of Oracle Forms manually?

    Thanks in advance,

    A

    Do something like this in the PRE-QUERY-trigger:

    IF :BLOCK.MOBILE1 IS NOT NULL THEN
         SET_BLOCK_PROPERTY('BLOCK', ONETIME_WHERE, 'MOBILE1 LIKE ''' || :BLOCK.MOBILE1 ||  ''' OR ' ||
                                                    'MOBILE2 LIKE ''' || :BLOCK.MOBILE1 ||  '''');
    
    END IF;
    :BLOCK.MOBILE1:=NULL;
    
  • Irregular behavior with calculated fields

    A new program,

    I am working on a form with a great many digital fields.

    These fields are used in a series of calculations

    A point - the first subtotal calculated field to a column of numbers

    Point two - the second calculated field subtracts a column of numbers of this total part-time

    .....................

    Item 3 - the third field calculated is titled the four columns of totals like that above.

    Article 4 - the last calculation is the total above, divided by four.

    A simple calculation is used to enter this total at the beginning of the next page and so on throughout the form.

    The problem is that sometimes I added figures to the agenda one, the number does not always update to the point four right now. I have to kind of jimmy with the entries a bit. ITIS as the totals column is late by a single entry.

    I also have a number of questions when returning back and remove entries.

    Any thoughts on what I am doing wrong?

    Steve

    You must set the order of computation of field for what makes sense for your form. In Acrobat 9, go into editing mode and select the forms: forms > edit fields > set field calculation order

    It's something else under Tools > forms in Acrobat 10

  • Need of a calculated field in my model

    Hello

    is it possible to have a calculated field in my model. The valid calculated field when I create an INTERNATIONAL organisation is based on the comic book which has the calculated field.

    My point is:

    -Need a field to calculate the average of days between two dates (like the start and end dates) to different folders.


    What is the best way to do it? a calculated field? Thank you.


    Kind regards

    Hello

    You push the calc up to your IO, or do it in the model. There is a blog on Calc data here:

    http://blogs.Oracle.com/XmlPublisher/2008/09/date_functions.html - Intro
    http://blogs.Oracle.com/XmlPublisher/2009/09/groovy_date_functions.html - date-specific diffs

    Tim

  • How to fill two text fields based on a simple drop down list

    I'm trying to set up a form so that the two text fields will fill with a text by default (separate for each text field) at the same time.

    Here is a screenshot of the fields.

    Thus, for example, if I select Utah in the drop-down list in 'State', ' OH Fund Center "is automatically filled in with APWSWR4949 and"OH WBS"is automatically filled in with WR49.73.0003.

    I have a similar script for down text in form fields, but the script does not work.  I tried the following script:

    var v1 = this.getField("RecState").valueAsString;

    If (v1 == "Utah") event.value = APWSWR4949;

    else event.value = "";

    However, it would not AutoFill OH Fund Center area.  And I have no idea how complete both fields at the same time.

    Any help would be greatly appreciated.

    Thank you!

    Crystal

    Strings must be enclosed in quotation marks. So change your code:

    var v1 = this.getField("RecState").valueAsString;
    if (v1=="Utah") event.value = "APWSWR4949";
    else event.value = "";
    

    If it works, then you can use code similar to your other field.

  • Receive error message when calculating the two fields with different date format

    I'm more familiar with SQL Server and Oracle, then after a search online without success, I ask here.

    I use developer PL/SQL with DB Oracle 11g Release 11.2.0.2.0 Enterprise 64-bit

    MyTable:

    ID_Number VarChar2

    Date of Date_Received

    Select ID_Number,

    Date_Received,

    To_Date (substr (ID_Number, 1.6), "YYMMDD") SentDate,.

    Date_Received - NumDays To_Date (substr (ID_Number, 1.6), "YYMMDD")

    FROM MyTable

    Where substr (ID_Number, 7.3) in ('ABC', 'ABD')

    and length (Trim (translate ((substr (ID_Number, 1,6)), '0123456789',' '))) a null value

    ID_Number Date_Received SentDate NumDays

    131002ABC1654106 10/16/10/2013-2013 14 2

    131004ABD8813899 4/12/2013-4/8/2013 4

    131014ABD1844832 10/16/10/14 OF 2013-2013 2

    Sometimes the first 6 characters in the ID_Number aren't the numbers and length (Trim (translate deletes records))

    I want just the records where NumDays > 2

    I tried to put the request in a subquery and using where NumDays > 2 outside.  I also tried using the calculation directly in the Where clause.  Without it in Where clause it works very well, with him in a place, I get the following error:

    ORA-01931: Date format picture ends before converting all of the input string


    I don't know how to put the two dates in the same format.  I tried to declare the format without result.  I don't understand how I can calculate in the selection, but do not use the same calculation in Where clause.

    Thank you for your help.

    Hello

    SQL is a language to describe the desired results.  How the system gets these results belongs to you don't have much say about which conditions will be applied when.

    One place where you can control the order of things is a CASE expression.  When you say

    CASE

    WHEN condition_1

    THEN expression_1

    END

    You can be sure that expression_1 will be evaluated only when cond_1 is set to TRUE.

    Try something like this:

    WITH got_sent_date AS

    (

    SELECT id_number, date_received

    CASE

    WHEN the TRANSLATION (SUBSTR (id_number, 1, 6)

    , 'x' 0123456789 '.

    , 'x'

    ) IS NULL

    THEN TO_DATE (SUBSTR (id_number, 1-6)

    , "YYMMDD".

    )

    END AS sent_date

    FROM MyTable

    WHERE (id_number, 7, 3) SUBSTR ("ABC", "ABD")

    )

    SELECT id_number

    date_received

    sent_date

    , date_received - sent_date AS num_days

    OF got_sent_date

    WHERE date_received > sent_date + 2

    ;

    If you would care to post some sample data (CREATE TABLE and INSERT statements) and the results desired from this data, I was able to test this.

    Of course, you'll still errors of execution if id_number starts with 6 digits, but they do not have to be valid, for example '131100' or '130229'.  This is one of the reasons why the date information storage in VARCHAR2 columns are a bad idea.  To work around this problem, see

    https://forums.Oracle.com/message/4255051

  • processing the page and inserting the calculated field

    Hello

    I use Apex 4.2.5 and oracle 11g

    In my form page, I have the size of fields assigned and used. the third "freesize" field that has to calculate the other field1 allocatedsize two fields (ie) - usedsize field2.

    the third freesize of field must be filled in automatically after calculation. When I press button creation or changes button apply, it must be updated automatically in the folder.

    How to do?

    Thank you

    Hi KJChellam,

    I suggest that you look at this thread for more information.

    Search for: dynamic action to email of automatic calculation based on the fields firstname and lastname in the form created in APEX

    Kind regards

    Benjamin.

Maybe you are looking for