Absolute values (ABS)

Post Author: ivanl
CA Forum: Formula
Hi,
I have a field "type" that has positive and negative values.  How do I ensure that the absolute value is extracted from database?
Thanks,
Ivan

Post Author: SKodidine
CA Forum: Formula
In CR XI you can use ABS function such as:
abs({table.field});
From CR XI help:
Action
Abs (x) returns the absolute value of x.
Examples
Abs(1.50)
Returns 1.50.
Abs(-1.50)
Returns 1.50.
Abs(10 - 7)
Returns 3.

Similar Messages

  • Absolute Value in Transformation level

    Hi Team,
    I want to insert abolute value in Transformation routine level.Pl provide me the routine code to instert absolute value of Exchange Rate.
    I have tried to put below code but its not working.
    ABS(Exchange Rate).
    Regards
    Ramakanth.

    Hi,
    In your case, I'd strongly recommend you to use formula instead of routines (where you do have absolute function working).
    If you still want to go for Routine:
    data: abs_val type f.
    if SOURCE_FIELDS-EXRATE_ACC < 0.
    abs_val = SOURCE_FIELDS-EXRATE_ACC * -1.
    else.
    abs_val = SOURCE_FIELDS-EXRATE_ACC.
    endif.
    RESULT = SOURCE_FIELDS-NETVAL_INV * abs_val.
    --Akashdeep

  • Order by absolute value

    Hi,
    I am trying to write a SQL query which returns the % difference between 2 columns in a table, in sorted descending order, based on the absolute value.
    The statement goes like this:
    SELECT ((col1 - col2)/col2)*100
    FROM table1
    WHERE col2 > 0
    UNION
    SELECT 100
    FROM table1
    WHERE col2 = 0
    ORDER BY 1 DESC
    What I really want is the ORDER BY clause to be something like this:
    ORDER BY ABS(1) DESC
    However, that results in the following error:
    ORA-01785: ORDER BY item must be the number of a SELECT-list expression
    Does anyone have a nice, efficient way for fixing the SQL query?
    Thanks!

    Add another column to your select, and order by that:
    SELECT ABS(((col1 - col2)/col2)*100),
    ((col1 - col2)/col2)*100
    FROM table1
    WHERE col2 > 0
    UNION
    SELECT 100, 100
    FROM table1
    WHERE col2 = 0
    ORDER BY 1 DESC
    null

  • Is there any function module to give absolute value of a number?

    Hi,
    Is there any function module to give absolute value of a number?
    That has similar functionality to the Built in Function ABS.
    Please let me know.
    Thanks,
    cs

    hi,
    why are you looking for any function module.
    You can easily get it by mathematical function ABS .
    Syntax : <Turget Variable> = ABS <Source Variable>
    \[removed by moderator\]
    Anirban Bhattacharjee
    Edited by: Jan Stallkamp on Jun 27, 2008 4:19 PM

  • SUMCT of ABSOLUTE values

    Hi all,
    I have been trying to implement the SUMCT function over the absolute values of forecaste sales quantity.I have the requirement to obtain the total of absolute value.
    Forecaste  AbsForecaste   SUMCT(Abs Forecaste)
    20                20                100  
    -10               10                 100
    40                 40                 100
    -30                30                  100
    above should be the output for SUMCT where as I am getting SUMCT column as 20..As it is not calculating on absolute but actual values.Is there anyway to implement this logic.
    Helping approaches will be rewarded

    Hello,
    create a CKF1 on forecast and not formula keyfigure to calculate absolute value. Then create one more CKF2 over CKF1 with exception aggregation as total and reference object bein the one with lowest granularity in the report. then create formula KF for SUMCT CKF2.
    Eg If your report is like below
    Char1 Char2 Char3 Char4 Forecast CKF1 CKF2 FormulaKF
    Create CKF1 with formula abs forecast
    Create CKF2 with CKF1 and exception aggregation as total and refernce char as Char4 (as it is the lowest granularity)
    Create FormulaKF with formula SUMCT CKF2.
    This will def work.
    Regds,
    Shashank

  • Cash Discount in absolute value, not in %

    Hello Friends,
    I have a scenario with respect to terms of payment, where the customer is entitled for a cash discount of Rs.100 per unit if the invoice is cleared within 7 days from the date of invoice, Rs.75 per unit within 14 days & Rs.50 per unit within 21 days with total credit period of 45 days.
    The problem I'm facing is that in the Terms of Payment configuration (transaction code OBB8), I'm able to store the cash discount in % and not in absolute value (field "percentage" under the "Payment Terms" heading in tcode OBB8).
    Request your suggestion at the earliest.
    Thnx & Rgds,
    Padmanabhan

    Hi,
    The CASH DISCOUNT will be given based on the Payment terms  with the CONDITION TYPE.
    In the Standard the CASH DISCOUNT condition types are SKTO & SKTV.
    If you are using the same condition types, change the CALCULATION TYPE  for these condition types in V/06  to B ( which is fixed amount)  and try.
    Hope it will solve your requirement.
    regards,
    santosh

  • Report similar to MC$4 that does not show absolute values

    Hi all,
    We need a report similar to Report similar to MC$4 which has the same drilldown capabilities but does not show absolute values, and instead shows the proper (actual) values.
    Or if its possible to change something in the MC$4 report to show the actual values and not the absolute.
    Thanks in advance!
    George

    HI
    Your input criteria should contain all plant numbers and the period to be analyzed.  Execute the report and then select:  Plant Analysis\Export\Transfer to XXL\Deselect all options and tick Plant, Storage Location and Month.  Follow the options to export to Excel.  Report will be based on Plant, Storage location and Month.
    Regards

  • Absolute value in ckf, performance effect?

    Hello BW Experts,
    req: always show positive values for one kf1 of a cube, even if you have negative values for kf1.
    options:
    create a ckf1 with the absolute value of kf1
    -- 1) are there any other options in the backend or frontend?
    -- 2) what are the performance effects of the abosolute function option as compared to having a kf in the cube.?
    Suggesions appreciated.
    Thanks,
    BWer

    Hi,
    You can multiply the values with -1 on the backend side or in the query itself there is an option of reversing the sign in the settings.
    Cheers,
    Kedar

  • Absolute value discount in Special Prices

    I have a customer that has special prices with a value discount, not a percentage one.
    I thought about adding a UDF to the Special Prices table and do a formatted search against it, but later I found that I cannot add an UDF to the Special Prices table...
    All the discount functionality in SBO is percentage based...how should I implement an absolute value discount?
    Any ideas will be much appreciated...

    Hi.
    This is sample code in C++ to add UDF.
    _bstr_t TableName = L"TableUID";
    _bstr_t FieldName;
    HRESULT hr;
    SAPbobsCOM::IUserFieldsMDPtr m_pUserFieldsMD = m_Cmp->GetBusinessObject( SAPbobsCOM::oUserFields );
    m_pUserFieldsMD->PutTableName(TableName);
    FieldName = L"FieldUID";   'without U_'
    m_pUserFieldsMD->PutType(SAPbobsCOM::db_Alpha);
    m_pUserFieldsMD->PutName( FieldName );
    m_pUserFieldsMD->PutDescription( L"desc");          
    m_pUserFieldsMD->PutSize(20);
    m_pUserFieldsMD->PutEditSize(20);
    if ( m_pUserFieldsMD == NULL )
    return -1;
    m_Cmp->StartTransaction();
    hr = m_pUserFieldsMD->Add();
    if (hr!=S_OK)
    'error'
    if ( m_Cmp->InTransaction )
    m_Cmp->EndTransaction( SAPbobsCOM::wf_Commit );
    Hope it helps.
    Kamil Wydra

  • Result row: absolute values

    Hi,
    In the properties screen of a key figure, the user can chose a lot of possibilities for <i>Calculate result as</i>. But there is nothing like 'absolute value'.
    What I want to achieve is that the BEx report is calculated in the normal way, but the only difference is that the result row should only contain positive values (that means: negative values should be multiplied by -1 ).
    Remark: the result may NOT be a calculation of absolute values! Instead it has to be a normal calculation (sum) and at the end, the minus sign of the negative values should be removed.
    <u>example:</u>
    A:          2000
    <u>B:         -3500</u>
    R:     1500
    Thank you in advance!

    Bart,
    Try this.
    Create a Formula for your key figure.
    Create an If condition and implement the logic
    Use the boolean funtion LEAF() - which returns 1 for individual values and 0 for results.
    E.G
    (leaf(KF)=0)((KF<0)(-1)(KF)+ (KF>=0)* KF) + (leaf(KF)=1)* KF

  • Snap to Absolute Value doesn't work in Logic 9

    I recently upgraded to Logic 9 and things have been good except that in my Piano Roll the "Snap to Absolute Value" setting stopped working for setting the ends of my notes. I migrated my settings over from Logic 8 and all my keys commands and preferences work perfectly so I am wondering if there is a new setting in Logic 9 I have to set to get the snap to work. When I try and lengthen notes whether I have "Snap to Absolute Value" set or not the resolution for changing the note length does not change and I can't get my note ends exactly where I want them. If I zoom in on the note ends and have "snap" on I can get the not ends to an absolute value, but I thought the point of the "Snap to Absolute Value" setting was that you didn't have to change your zoom to snap to absolute value. Any suggestions would be helpful.

    Are you using a locale different from the default (En-US)? Can you check if the phone locale that was installed on the CUCM is compatible with the phone firmware? Can you try a higher phone firmware and higher locale which is compatible with that phone firmware?

  • Expression pedal: can one set absolute values?

    I have a set up where I am using an expression pedal (Moog pedal through an Apogee Gio) to control the resolution value in Bitcrushed in Mainstage. The pedal is fine when it is all the way on, but is so sensative that it sweeps rapidly to off when I change press down on it. Is there a way to adjust the speed of its sweep, and also to set an absolute low value so that it does not go all the way to zero?

    Hi
    You can do both basic Min/Max scaling, and alter the curves etc with MS2. All of this is accessed via the Screen Control Inspector
    CCT

  • Properties problem.Why do I have to use the absolute value for the loadfile

    My class is in the default package, location = D:\Java\MyClass.class
    try{
          p.load(new FileInputStream(new File( "Properties.txt" )));
    //This fails
    try{
          p.load(new FileInputStream(new File( "D:\\Java\\Properties.txt" )));
    //This worksIf I want my app to be deployed in any folder then having the path hardcoded in the app is not an option

    try using getClass().getResourceAsStream instead of FileInputStream ...

  • I am a rookie and need help with max and min values

    Hello all, i am into this intro to java class. my assignment is to write a program that prompts the user for two integers and then prints the sum, difference, average, product , distance (absolute value of the difference) Maximum(largest of the two) and Minimum(smallest fo the two) here is my code so far
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.Math;
    public class Sample4
       public static void main(String[] args) throws IOException
          try // attempt the following
    {           // create the stream to read from
    InputStreamReader istream = new InputStreamReader(System.in);   // create a buffer to hold the stream
    BufferedReader console = new BufferedReader(istream);           // prompt the user
          System.out.println("Enter a number please");              // get input as a string
          String input = console.readLine();                        // convert to an integer
          int num1 = Integer.parseInt(input);
          System.out.println("Enter a number please");              // get input as a string
          String input2 = console.readLine();                       // convert to an integer
          int num2 = Integer.parseInt(input2);
          int sum = num1 + num2;                                    // get the sum of the two inputs
          int difference = num1 - num2;                             // get the difference of the two inputs
          int product = num1 * num2;                                // get the product of the two inputs
          int average = sum / 2;                                    // get the average of the two inputs
          int abs = Math.abs(difference);                           // get the absolute value of the two inputs
              // new section
                 // display the number
          System.out.println("The total sum = " + sum);
          System.out.println("The total difference = " + difference);
           System.out.println("The total product = " + product);
           System.out.println("The total average = " + average);
           System.out.println("The total absolute value = " + abs);
    } // if something breaks, catch the exception
    catch (IOException e)
       System.out.println(e); // displays the exception
       System.exit(1);  // quits the program
    }what will be the right syntax or code to find the MAX and MIN values of two numbers a User Inputs, hope someone can help with this. thank you for your help.

    Thanks alot man, sheesh i do not know why my book
    doesnt give me all the static methods. but i do really
    appreciate your help. peaceA complete list of the java.lang.Math methods can be found at http://java.sun.com/j2se/1.4/docs/api/java/lang/Math.html
    btw,
    max(a, b) == (a > b) ? a : b
    min(a, b) == (a < b) ? a : b

  • Calling Report Parameter in Row Formula - Report Painter

    hello
    i have a unique situation in which 11 months out of the year i need to call a certain "cell" and then in December I need to call another "cell"
    i figured if that is possible I would be able to do this one of two ways:
    IF "Eval Period" <> 12 THEN "Y021" ELSE "Y023" - this would result in a single line solution
    IF "Eval Period" <> 12 THEN "Y021" ELSE 0
    IF "Eval Period" = 12 THEN "Y023" ELSE 0
    the later formula would be split into two lines.
    i am a big excel and VBA user (where this would be possible with some trick coding), but i am slowly learning the art of report painter. Is this possible. I know you can define a row or column with a variable, but can you call it out in a formula?
    thanks

    Hi Adam01,
    I am not sure if I have understood your problem, but I am going to comment one thing in case it is helful for you.
    If you press F1 in the u201CFormulaLineu201D when you are editing the formula, you can read:
    Formula syntax in the Report Writer
    A formula consists of operands, operators, numbers, and parentheses.
    The following operands are possible:
    Row numbers (for example, Y001 for row 001)
    Column numbers (for example, X001 for column 001)
    Cells (for example, Z001 for a specific total in a report)
    Value variables (for example, '1PERIK' for the value variable 1PERIK)
    You can enter numbers directly, with or without a decimal point (for example, 100 or 2.5).
    Example (percentage difference):
    ( X001 - X002 ) * 100 / X001
    In addition to basic arithmetic operations + - * / the following operators are supported:
    Operator Example
    ABS   Absolute value ABS(-10) = 10
    DIV   Quotient-whole no. div. 10 DIV 3 = 3
    MOD   Remainder-whole no. div. 10 MOD 3 = 1
    SQRT  Square root SQRT(9) = 3
    INT   Truncation to integer INT(3.9) = 3
    TRUNC Truncation to integer TRUNC(3.9) = 3
    ROUND Rounding ROUND(3.5) = 4
    EXP   Exponential function EXP(1) = 2.71828
    LOG   Logarithm LOG(10) = 2.3025
    SIN, COS, TAN  Trigonomic functions (length of a curve)
    Example (difference of absolute values):
    ABS(X001) - ABS(X002)
    Logical Expressions:
    IF c1 THEN f1 ELSE f2
    where c1 is a comparison condition, f1 and f2 are formulas.
    In comparison conditions, the following operators are allowed:
    < less than
    <= less than or equal to
    > greater than
    >= greater than or equal to
    = equal to
    Example (determine maximum value):
    IF Y001 > Y002 THEN Y001 ELSE Y002
    For instance you can write:
      IF '8A-PER' < 12 THEN Y023 ELSE Y021
    Best regards,
    Paco

Maybe you are looking for