Weighted average end days: how the sum in different currencies?

Hello

I have to introduce a new column named "averages weighted days late" in one of the models.

It was easily handled by the code in the Oracle report: Aging Ar: calculated as <? If: SUM_PAYMENT < = 0? > 0 <? end if? > <? If: SUM_PAYMENT > 0? > <? SUM_W_DAYS_LATE div SUM_PAYMENT? > <? end if? > UX f

The customer wants that this weighted means against the different currencies for a single client: How do I implement that?

Example: Client A - average weighted days late:-16-20 in USD and EUR. = > report displays only the first currency - in this case EUR = >-16 (which is not what is expected)

Logic: I need to run (-16) +(-20)/2. The logic is simple. However, where should I create this change? Also, this change must be connected to the period during which the report is run for / just for the money? I guess it's related at the same time.

Thanks in advance

and then divide it by the number of transactions.

That's your logic? If yes then ok

I don't know full logic

And this must be done in the sql used in the xml file, I guess. Is there an easier option to calculate the end of days average weighted by a modification of the model code? Curious.

If you already have some fares in the xml file to recalculate, then you can do so by model

If you do not have the rate, then you can add it to xml format and then calculate by model

or you can calculate in sql (as an example of data model) and then only show models

How will be used it is your decision

Tags: Business Intelligence

Similar Questions

  • How the SUM cells including the text and the number?

    Hello world

    Someone can tell me how the SUM cells include the text and the number?

    1 Bob 20

    2 30 Jane

    3 50 Jame

    Total 100

    Thank you

    Hi Jordan,.

    If the numbers are not always two digits, FIND the position of the space between the number and name:

    Formula in B2 (fill down)

    = FIND("",A2)

    Then use the LEFT function to get the number in the column C:

    Formula in C2 (fill down)

    = LEFT (A2, B2)

    This will give a text string (Tip: left-aligned).

    Convert to a numeric value in the D column with the VALUE function:

    Formula in D2 (fill down)

    VALUE = (C2)

    (Tip: propped right)

    Table 1 has a header row and footer of the line, and the SUM is easy. Formula to the D8 footer line:

    = SUM (D)

    Kind regards

    Ian.

    Edit: You can hide columns B and C

    Ian.

  • How graphic how the sum of several metrics of in a dashboard.

    I'm looking to find out how the graph of the sum of multiples of the metric, as CPU ready, or latency of disk in one graph on a dashboard / report.

    An example would be showing collective management s VM in balloning of CPU and memory of the pool on line on a chart.

    Thank you!

    If you want the chart to reflect everything that you can do the stacking graphics option which will be sleeping all values.

  • How the sum of a series of if Athens?

    Given:

    Image.jpg

    I need adding the cost of reception (PM01) breakfast (Cost01), reception cost (Cost02) and lunch cost of reception (Cost03).

    If the cost of each receipt exceeds each meal allowance, use value meal in sum compensation.

    If the cost of each reception is less than or equal to each value of the meal allowance, then use the cost of reception in all.

    You can use a calculation script customized to the field which displays the sum, something like:

    Custom calculation script

    (function () {}

    Get the field values as numbers

    var v1 = + getField("Cost01").value;

    var v2 = + getField("Cost02").value;

    var v3 = + getField("Cost03").value;

    Add the eligible amounts of breakfast, lunch and dinner

    and set the value of this field

    Event.Value = Math.min (v1, 12) + Math.min (v2, 17) + Math.min (v3, 27);

    })();

  • Columns of the sum of different record count of joined tables

    I have a problem with a query, please help.

    I have two tables:
    create table rec_a (key_code varchar(20),
                    TOT_AMT varchar(20),
                    INV_AMT varchar(20))
    / 
     
    create table rec_B (key_code varchar(20),
                    INVOICE_AMT varchar(20),
                   PAID_AMT varchar(20))
    / 
     
    insert into REC_A values (123123,  1168182.16, 1168182.16);
    
    insert into REC_B values (123123, 205699.04,205699.04);
    insert into REC_B values (123123,130912.78,130912.78);
    insert into REC_B values (123123, 81622.87,81622.87);
    insert into REC_B values (123123, 438032.43,438032.43);
    insert into REC_B values (123123, 159936.17,159936.17);
    insert into REC_B values (123123, 151978.87,151978.87);
     
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16


    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87


    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)
    SELECT B.key_code,sum(A.invoice_amt),sum(a.paid_amt),SUM(b.tot_Amt),SUM(b.inv_amt) FROM rec_a B, rec_b A WHERE A.KEY_CODE=B.KEY_CODE AND B.KEY_CODE in ('123123')
    group by B.key_code
    I got this:

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16


    Can someone help me out here?

    Thank you

    Published by: 1003064 on April 29, 2013 03:19

    Hello

    1003064 wrote:
    I have a problem with a query, please help.

    I have two tables:
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16

    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78...
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87

    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)

    SELECT B.key_code, sum (a.invoice_amt), sum (a.paid_amt), SUM (b.tot_Amt), SUM (b.inv_amt) FROM rec_a A, rec_b B WHERE A.KEY_CODE = B.KEY_CODE AND B.KEY_CODE in ('123123')
    B.key_code group

    I got this:
    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16

    Thus, the last 2 columns must be exactly what is stored in table1? Then either
    b include these columns in the GROUP BY clause and not to use the SUM,
    (b) the GROUP BY on rec_a alone, separately, can't join the results to the rec_b, or
    (c) using MIN or MAX, instead of SUM. (Anyone. Since there is only one value, MIN will be the same as MAX.)

    Here is an example of (a):

    SELECT    B.key_code
    ,       sum (a.invoice_amt)     AS sum_invlice_amt
    ,       sum (a.paid_amt),     AS sum_paid_amt
    ,       b.tot_Amt
    ,       b.inv_amt
    FROM        rec_a          A
    ,        rec_b          B
    WHERE        A.KEY_CODE     = B.KEY_CODE
    AND        B.KEY_CODE      in ('123123')
    group by  B.key_code
    ,            b,tot_amt
    ,       b.inv_amt
    ;
    

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • Capture the salary of the employee in different currencies in a single enterprise group

    Hello

    Scenario: According to group unique buiness, information of the employees of several countries are counted (as there may be very few employees in each of these countries).

    Status of pay is NOT implemented, how we capture information on country-specific employee wages to say, capture of an employee's salary in different currencies under unique business group.

    Thank you

    You can use Add'l salary admin. Details FDF to capture the currency and converted value. Salary of the hand will be in a base currency.

    Thank you

  • SQL - how the sum on specific lines

    Hello

    Forever, the line, I want to show MySQL for previous lines, only when the previous values are equal = 1,.

    and only for successive lines.

    for example, the result expected on the column 'result '.

    Result of ID value

    100 1-

    130 1 2-> (current 1 + pre 1)

    3 500-

    1 600-

    2-1-700-> (current 1 + pre 1)

    1000-1-3-> (current 1 + precedent1 + 1 previous pre)

    4 1 1200

    How can do us it easily?

    I thank everyone in advance.

    Here's a way...

    with t (id, value) :)

    Select 100.1 in union double all the

    Select 130.1 Union double all the

    Select 500,3 Union double all the

    Select 600,1 Union double all the

    Select 700,1 Union double all the

    Select 1000,1 Union double all the

    Select double 1200,1

    )

    Select

    ID

    value

    case

    When start_of_group = 0 and = 1 value

    then MySQL over (partition by group_num by id order)

    Another null

    end result

    de)

    Select sum (start_of_group) (any order by id) as group_num

    start_of_group

    id

    value of)

    Select

    case

    When lag(value,1,0) (any order by id)! = 1 then 1

    0 otherwise

    end as start_of_group

    id

    value

    t

    )

    )

    order by id

    ;

    Kind regards

    Bob

  • calculation of ratios and rounding - how the sum of last record to give 1

    I'm putting in a single query to calculate the reports for an unknown number of records. I want to turn the ratios to 5 decimal places and I want the total reports of equal to 1.

    for example

    If I have 3 folders with Qty total overal 4,5,6 is 15
    I note 3 lines
    Round (4/15.5),
    Round (5/15.5),
    Round (6/15.5)

    but I want to ensure total = 1
    so I will try to do something like

    Round (4/15.5),
    Round (5/15.5),
    1 - round(4/15,5) - round(5/15,5)

    can someone help show me the sql construction? I've been trying and failing using where clause

    of course this example would add to 1 but other unknown ratios may not match up to 1.

    Published by: user12154024 on November 2, 2009 22:32

    Hello 12154024,

    Welcome to the forum. May not be a more elegant solution, but it shows how it works step by step

    WITH t AS (
    SELECT 4 n FROM dual
    UNION ALL
    SELECT  5 n FROM dual
    UNION ALL
    SELECT 6 n FROM dual
    )
    ,t1 AS (
    SELECT  n
           ,ROUND(RATIO_TO_REPORT(n) OVER (),5) AS rr
           ,COUNT(n) OVER () AS c
           ,ROW_NUMBER() OVER (ORDER BY n) AS rn
    FROM    t
    )
    ,t2 AS (
    SELECT  n
           ,rr
           ,SUM(rr) OVER (ORDER BY n) s
           ,c
           ,rn
    FROM t1
    )
    SELECT  n
           ,rr
           ,CASE WHEN c = rn THEN
                rr + (1 - s)
            ELSE
                rr
            END rr2
           ,s
    FROM    t2
    ORDER BY rn;
    
    N   RR        RR2       S
    --- --------- --------- --------
    4   0.26667   0.26667   0.26667
    5   0.33333   0.33333   0.6
    6   0.4       0.4       1        
    
    3 rows selected
    

    The part "WITH t AS" generates data
    T1 calculate the ratio, counts the number of records and signs a current issue
    T2 to calculate a cumulative ratio
    the last part takes these data and for the last record (number = count running) it allows to adjust the ratio.

    You can see if you are using other data

    WITH t AS (
    SELECT 4.78 n FROM dual
    UNION ALL
    SELECT  5 n FROM dual
    UNION ALL
    SELECT 6 n FROM dual
    )
    ...
    
    N    RR       RR2      S
    ---- -------- -------- --------
    4.78 0.30292  0.30292  0.30292
    5    0.31686  0.31686  0.61978
    6    0.38023  0.38022  1.00001  
    
    3 rows selected
    

    Concerning
    Marcus

  • How the sum of these two tables?

    Hello

    I have two tables

    DESC ACTIVITE_EXCEP_FAITE

    NUMBER OF FICHE_ID

    NUMBER OF SERVICES_ID

    NUMBER OF ACTIVITES_EXCEPTIONNELLES_ID

    NUMBER OF TIME

    NUMBER OF ACTIVITE_EXCEP_FAITE_ID

    DESC ACTIVITE_FAITE

    NUMBER OF FICHE_ID

    NUMBER OF ACTIVITES_ID

    NUMBER OF SECTEURS_ID

    LENGTH NUMBER (8.2)

    NUMBER OF ACTIVITE_FAITE_ID

    NUMBER OF TYPE_ACTIVITE_ID

    I want to add the column to the DURATION of the two tables when they get the same FICHE_ID. FICHE_ID is not a join field.

    I've tried this application, but it gives result when two recordings of the two table share the same number FICHE_ID.

    SELECT AF. FICHE_ID, SUM (NVL (AF. LENGTH, 0)) + SUM (NVL (AEF. LENGTH, 0))

    OF AF, ACTIVITE_EXCEP_FAITE AEF ACTIVITE_FAITE

    WHERE AF. FICHE_ID = AEF. FICHE_ID

    GROUP BY AF. FICHE_ID;

    Can you help me write this selection?

    Thank you very much for your help!

    Like this?

    select nvl(af.fiche_id, aef.fiche_id) fiche_id
         , sum(nvl(af.duree,0)) + sum(nvl(aef.duree,0)) duree
      from activite_faite af
      full join
           activite_excep_faite aef
        on af.fiche_id = aef.fiche_id
     group by nvl(af.fiche_id, aef.fiche_id);
    
  • How the CDO is different segments? Can I use segments in programs?

    Hello

    I want to use segments in programs? is this Possible?

    Hello

    We cannot use segments in the programs. Segment is created to filter a different type of contacts based on activities or field values. Although CDO is created to separate some contact fields or related data.

    Thank you

    edynamic expert Eloqua

  • How the new clothes (different) can be designed to FUSE characters?

    I work on an educational game from the 16th century and need clothing of period style. Is there a way that it can be shaped to work with FUSE characters?

    Yes, absolutely!  FUSE is a pipeline very open so you can import a lot of custom content.  The clothes are pretty easy.    The only requirement is that it must be "worthy" on a base mesh, that we provide.  There are a few other guidelines that can help to improve quality within fuse and give you options, advanced then here is the complete guide to creating custom content.  I had read article of general guidelines, then the article of clothing before starting in order to have a good understanding at all.  If you have any questions then please let me know!

  • How the PP cs6 differs from cs4?

    Hello

    I have cs4 loaded on my computer but I have not used for a long time since the purchase of fcp 7. I use 7 FCP all the time that I still hesitate to move to FCPX, however I have problems with being able to play DSLR footage natively. I know 6 will allow for this but didn't CS4? Or should I upgrade to CS6?

    Thank you!

    The biggest difference is that Pr CS6 is a 64-bit application,

    and requires a 64-bit operating system.

    CS4 is a 32-bit application.

    CS4 is likely to import your media DSLR with the addition of

    Plugin Of MainConcept's MPEG Pro HD , but performance will be

    away from the ability of CS6.

    There are an exceptional AVCHD bug in CS6,

    but the publication of a fix in the indefinite future has been promised.

    Video and audio glitches. AVCHD video - CS6 bug

    http://helpx.Adobe.com/Premiere-Pro/KB/audio-video-glitches-AVCHD.html

    Fix promised:

    Premiere Pro CC July 2013 update

    "Our commitment to customers includes those who have not yet".

    the creative cloud Subscriber or dependent on the CS6, and counting

    get out an update for Premiere Pro CS6 in the coming weeks that

    will address a clip AVCHD extending over the issue. »

    http://blogs.Adobe.com/PremierePro/2013/07/PPro-CC-July-2013-update.html

    CS6 download trial - where can I find it?

    http://forums.Adobe.com/message/5459679#5459679

    CS6 - buy perpetual license version (rental not cloud creative)

    http://www.Adobe.com/products/catalog/CS6._sl_id-contentfilter_sl_catalog_sl_software_sl_c reativesuite6.html? promoid = KFPMZ

    Buy an upgrade instead the full version, click on the button buy

    then select "I want to buy: 'Upgrade' rather than 'Full'."

    CS5 and CS5.5 products are eligible for an upgrade to CS6.

  • BEEP Scheduler - last day of the month

    Is there a a way to schedule reports to run on the last day of the month using the Scheduler of BEEP? I see that I can choose to run the monthly report and I choose the day to run it, but the last day of the month is different from one month to the other most of the time. Is it possible to do so in the Scheduler?

    Thank you!

    Oops, my bad,
    I did not review the request clearly.

    There is possibility to plan the report, because every month and he asks date of the month.
    If you register 31, his is not going to run it for each month, since used 31 are present in every month.

    Note: And there is no provision in the bi-editeur before you do :), front-end Bi Publisher accuses this support.
    You can use WebService at fire report every end of month :), but if you seek support front end 'calendar' homepage, start SR.

    As far as I know, its a bug, please contact technical support and connect a SR and let me know of the State.

  • Need for a function defined by the user in order to obtain a weighted average

    Hello

    We have a table where we want to device the weighted average for a column of prices below using formula,

    sum (quantity * price) / sum (qty)

    We have a few lines where part or all of the columns that is price or quantity can be NULL.

    We have tried to write the function as follows however, it fills even after 30 minutes, where as we have the addition of this feature request could was completed in 25 seconds.

    Please note that we are dealing with big data i.e. the table could have 50 million records. It has appropriate indexing and other components to improve performance required.

    We know that we did something wrong in the creation of feature below, but we are unable to resolve

    CREATE OR REPLACE FUNCTION "WEIGHTEDAVGPRICE" (PCOLNAME NUMBER( ) RETURN NUMBER

    IS

    TEMP NUMBER (26,13);

    BEGIN

    SELECT SUM (QUANTITY * PCOLNAME) / SUM (QUANTITY) IN TEMP DE FEES;

    RETURN TEMP;

    END WEIGHTEDAVGPRICE;


    Here, we send the parameter THAT PCOLNAME represents the name of the price column we want to do a weighted average.


    We know we could do this without adding a feature, but we need instructions BOX, and then in our SELECT clause. We use toplink to query the database, in this case, it will be difficult to covert.

    Also, we want this function to be used in other places as well.


    Thank you

    @Bhagyesh KNW



    The reason for the decrease in performance when you use the function, you call the function from a query and which is originally a context switch between SQL and PL/SQL engines.  That is known to slow down performance.  If you can only do the task in SQL, you must do so, in order to avoid context switching.

    It would be useful that you provided a few sample data and expected the output, as indicating the version of your database, so that people can understand and help you better.

    Please read:

    Re: 2. How can I ask a question in the forums?

  • How do rotate on a date and see the sum of the value of another column

    Hello

    I searched through the forum and cannot find a query similar to my question feels so post this new thread.

    First of all, it is probably useful indicating that I am using Oracle 10 g.

    I have a table that is used to store the details of the booking (essentially a booking system) and I would use this data to display the details of the customers stay on one line.

    The table has the following columns:
    BOOKING_ID
    CUSTOMER_ID
    DATE_OF_ARRIVAL
    NUMBER_OF_NIGHTS
    NUMBER_OF_PEOPLE
    Some example records could be:

    BOOKING_ID    CUSTOMER_ID     DATE_OF_ARRIVAL    NUMBER_OF_NIGHTS   NUMBER_OF_PEOPLE
    --------------------------------------------------------------------------------------------
    1                    201      13-JAN-2010        5                   1
    2                    202      13-JAN-2010        3                   2  
    3                    202      13-JAN-2010        4                   1
    4                    203      15-JAN-2010        2                   3
    On this basis I would like to display the output so that I can show a sum of the NUMBER_OF_PEOPLE reserved to per customer per day, as such:
    CUSTOMER_ID     13-JAN   14-JAN   15-JAN   16-JAN   17-JAN   18-JAN   19-JAN 
    -----------------------------------------------------------------------------------------
    201                   1       1        1        1        1        0        0
    202                   3       3        3        1        0        0        0
    203                   0       0        3        3        0        0        0
    I watched analytical functions in the documentation and several books of Oracle that I have, but have so far struggled to find how to make the performance desired. Even using the excellent response to the previous post on the forum, I got Re: how to count the occurrence of a date in a range I was not able to get a feasible request.

    Any help or advice would be much appreciated.

    Kind regards
    Stu

    Published by: macmanxie on January 10, 2011 21:16

    Hello

    macmanxie wrote:
    ... The suggested approach goes only to return a number if the DATE_OF_ARRIVAL corresponds to the date in the CASE statement, however I have the added complexity of wanting to show a count of all the days that the customer is booked, for, by making use of the NUMBER_OF_NIGHTS. I tried to use some of the examples provided on morganslibrary.org, for example:

    sum( CASE WHEN  TRUNC (arrival_date) between '01/13/2011' and TRUNC (arrival_date+no_of_nights) THEN nvl(no_of_people,0) ELSE 0 END) AS jan_13
    

    but this does not produce the desired result.

    You check if arrival_date is between January 13 and arrival_date + no_of_nights (as if the arrival date could all be posterior to the arrival_date + no_of_nights).
    Are not really interested in whether or not January 13 ib between arrival_date and arrival_date + no_of_nights?

    NVL ( SUM ( CASE
                    WHEN  TO_DATE ( '01/13/2011'
                           , 'MM/DD/YYYY'
                         )          BETWEEN  TRUNC (arrival_date)
                             AND       TRUNC (arrival_date) + no_of_nights
                 THEN  no_of_people
             END
           )
        , 0
        )          AS jan_13
    

    Always format your code. It is important to format your code if you are the only who who will ever read but it is even more important if you are posting on a forum like this and ask other people to read.
    Not to compare the DATEs in the strings; explicitly use a conversion function, like TO_DATE, above, where necessary.
    Both
    SUM (NVL (x, 0)) and
    NVL (SUM (x), 0) get the same results, but the latter is more effective. If you have 1000 lines, the first way is calling NVL 1000 times, but the second way is calling only once.

    If your previous thread
    Re: How to count the occurrence of a date in a range
    Gets you the right data, but it has one row for each distinct combination of customer_id and date, then you can switch it to a form that contains a line by the customer and another column for each date.

    If you need help, post CREATE TABLE and INSERT statements for some examples of data and outcomes from these data. The post you are trying better to a request, including a subquery that gets no cross-the raw table dynamic results.
    There will be a fixed number of columns in the output swing? If this is not the case, how do you deal with that? Which of these options in the thread I posted above)
    Re: County report and the sum of the number of rows by multiple columns
    ) is best for your needs? Than others is acceptable?

Maybe you are looking for