How to do a TopN Sort based on a formula

Hi all,
My report has two groups, Store and Department.  In the details section are multiple jobs per store with costs. These are subtotalled by Store and Department.  I want to compare total spend for each store with the store budget and produce a list of the Top 10 stores based on the percentage actual spend/budget. 
My problem is I can only do a Top 10 sort on a summary field and I cannot summarise the percentage field as this is a formula which doesn't seem to allow summaries.
Any help much appreciated.
Cheers,
JD

Jan,
Here are a couple of options.
1) Do the calcuations on the database (thru either a stored proc or command object).
2) Insert a crosstab where the rows are based on the Store and the summarized field is based on the formula that outputs the percentage of the actual vs budget as a Maximum. You can then do a TopN sort on the crosstab
Edited by: Graham Cunningham on Oct 10, 2008 8:27 AM

Similar Messages

  • How to sort based on my priority in Activity search view.

    Hi,
    In Activity Search category ddlb should show based on my priority order but its showing default based on ascending order based on alphabetical order. How can I assign the values based on my priority how can I archive this? I want to sort based on my values.
    Component : BT126S_APPT
    View : BT126S_APPT/ApptSQ
    CN : BTQACT
    Attribute : CATEGORY
    can redefine get_v_category in search view please guide me.
    Regards,
    Jemmi.

    method GET_DQUERY_DEFINITIONS.
    *CALL METHOD SUPER->GET_DQUERY_DEFINITIONS
    RECEIVING
       RT_RESULT =
    Method returns value help definitions of advanced search
    The method is called from the advanced search tag as a base of its operation
    Take value help definitions from cache if possible
    NO adjustments are done! - Take the operators as set in vrmc_dq
      FIELD-SYMBOLS: <rt_result> TYPE crms_thtmlb_search_field_info.
      DATA: lv_getter TYPE string,
            lv_cnode  TYPE REF TO cl_bsp_wd_context_node_asp,
            lv_operator TYPE crm_thtmlb_search_operator.
           category  TYPE REF TO cl_bsp_wd_context_node_asp.
      lv_cnode = me->get_dquery_cnode( ).
      IF lv_cnode IS BOUND.
        Delegate operation to advanced search context node
        me->dquery_valuehelps = lv_cnode->get_dquery_valuehelps( ).
        rt_result = me->dquery_valuehelps.
      ENDIF.
      LOOP AT rt_result ASSIGNING <rt_result>.
            IF <RT_RESULT>-FIELD = <category>
            DELETE <RT_RESULT>-DDLB_OPTIONS WHERE KEY '001' OR
            KEY '003' OR
            KEY '005' OR
            KEY '006' OR
            KEY '201' OR
            KEY '401'.
            ENDIF.
        LOOP AT <rt_result>-operators  INTO lv_operator.
          CASE lv_operator.
            WHEN 'NM'. "'EM' OR  'NM' OR 'SW'.
              DELETE <rt_result>-operators INDEX sy-tabix.
            WHEN 'EQ'.
              IF sy-tabix > 1.
                DELETE <rt_result>-operators INDEX sy-tabix.
                INSERT 'EQ' INTO <rt_result>-operators INDEX 1.
              ENDIF.
          ENDCASE.
        ENDLOOP.
        CONCATENATE 'GET_V_' <rt_result>-field INTO lv_getter.
        TRANSLATE lv_getter TO UPPER CASE.                    "#EC SYNTCHAR
        TRY.
            CALL METHOD me->(lv_getter)
              CHANGING
                cs_result = <rt_result>.
          CATCH cx_sy_dyn_call_illegal_method.
        no V-Getter found
        ENDTRY.
      ENDLOOP.
    ENDMETHOD.
    it's showing error Field "<CATEGORY>" is unknown. It is not contained in one of the specified tables nor is it defined by a "DATA" statement. "DATA" statement.

  • Sorting based on a specific value in Columns

    Hi All,
    Crystal 2008 version I have. And we are connecting to BW queries as source.
    In a crosstab, I want to sort my row values based on a column value.
    For example, in rows I have an element with three values . In column I have only one element(month), with couple of month values. My requirement is to sort rows based on a specific month (Mar'09 for example).
    .....................Jan'09......Feb'09.....Mar'09
    ABC...............10.............323...........33....
    XYZ...............32..............33............11....
    FGH...............5................34.............55...
    But when I try to sort based on the Month, I can not select a specific value(mar'09). And it sorts based on the total value (sum of all months).
    How can I achieve this problem?
    Thanks
    Ozan

    For {Sort Value}, if you wanted to sort on the Jan column, then substitute the field name that your example shows as 10 in row ABC.  For {row value}, substitute the field name that is used in the first column (ABC in the example).
    In other words, take the value that you want to sort on, and put it in front of the value currently displaying as the row header.  Then, sort on the results.
    The purpose of the "000000000.00" is to make the length of the number, when converted to string, a consistent size.  This is needed (a) so you know how many characters to strip off when displaying the row value, and (b) so the records don't sort as 1, 12, 2, 234, 235423, 25, 3, ...
    HTH,
    Carl

  • URGENT - Does Select Query Sort based on RowId ?

    Does Select Query Sort based on RowId ?
    Eg: Select * from Employee;
    RowId primkey name
    aaaa 1 kiran
    aaab 2 kumar
    aaac 3 someone
    Now when i delete the primkey: 2 row.
    I will have:
    RowId primkey name
    aaaa 1 kiran
    aaac 3 someone
    Now when i insert a new record:
    RowId primkey name
    aaaa 1 kiran
    aaac 3 someone
    [Comment: Here the rowid can either be a new one like 'aaad' or 'aaab' is also reused.]
    aaad 4 somename
    My requirement is that the 'aaab' should not be reused.
    Can any one pls suggest some way.

    Dear Friend,
    Plese gothrougth once following steps... (One by One)
    Hope you can understand how Rowid Creating and Updting in you table.
    SQL> select rowid,enumber from t;
    ROWID ENUMBER
    AAAJ4oAABAAAWlyAAA 1
    AAAJ4oAABAAAWlyAAB 2
    AAAJ4oAABAAAWlyAAC 3
    AAAJ4oAABAAAWlyAAD 4
    SQL> select rowid,enumber from t where enumber = 2;
    1 row deleted.
    SQL> insert into t values(9):
    1 row created.
    SQL> select rowid,enumber from t;
    ROWID ENUMBER
    AAAJ4oAABAAAWlyAAA 1
    AAAJ4oAABAAAWlyAAC 3
    AAAJ4oAABAAAWlyAAD 4
    AAAJ4oAABAAAWlyAAE 9
    SQL> delete from t where enumber = 3;
    1 row deleted.
    SQL> insert into t values(3);
    1 row created.
    SQL> select rowid,enumber from t;
    ROWID ENUMBER
    AAAJ4oAABAAAWlyAAA 1
    AAAJ4oAABAAAWlyAAB 3
    AAAJ4oAABAAAWlyAAD 4
    AAAJ4oAABAAAWlyAAE 9
    Regards,
    G V Sreenivasulu

  • How to get the pricing hierarchy based on the delivery date for sales order

    Hi,
    How to get the pricing hierarchy based on the delivery date for sales order other than system date.
    My requirement is to get the Pricing hierarchy based on the delivery date other than system date.
    Waiting for kind response.
    Best Regards,
    BDP

    HI Sai,
    please refer teh document already how to write FM based extration on generic extractors.
    and here  the logic to find the latest records values:-
    -> get the data in an internal table
    ->Sort the internal table data based from date descending
    -> Using READ statement , we can read the first record of the table which is nothign but your latest record.
    Regards.
    Sakthi

  • How do I access the web-based utility

    I just purchased a wireless router...WRT300N. I want to access the "web-based utility" in order to update the firmware.
    How do I access the web-based utility...help!
    Thanks.

    Access the router’s web-based setup page.
    For instructions, click here.
    Linksys Easy Answer 4030, applies to WRT300N
    Upgrading the Linksys Router's Firmware
    Hope this helps,
    Lilla
    Westell 6100 modem/router; Linksys WRT54GL v1.1 router firmware 4.30.9; Linksys WPC54G v2 Notebook Card; CenturyTel DSL using PPPoE

  • In BI how to filter the selection options based on inputs on top field

    Hi Friends,
    In BI, How to filter the selection options based on inputs on top field.
    The system should automatically filter the lower level drop downs based on the selection of a higher level.
    For e.g. :
    If a user selects a Country then the States drop down should only display the State's belongs to the Country. Similarly when a State is selected, the District drop down should display only those District's belongs to the State.
    Thanks in Advance.
    Regards
    Jayaram M

    Hi Anil,
    Thanks for reply but I couldn't use Compounding Characteristic here. Need some other solution.
    Regards
    Jayaram M

  • How to change the default sorting in iTunes

    Hi,
    Does anyone know how to change the default sorting method for all items in iTunes?  I use the third option for organizing the library as a whole (the one that has a list of icons for bands that you double click to show only that band's songs).  The only sorting method I use is to sort by Album by Year (ascending), this makes the most sense to me.  I can tell that iTunes is attempting to remember when I do this for certain artists, but it epically fails at maintaining this sorting pattern.
    To be clear, say I open Radiohead and click through to have it sort with the above method.  Everything works great, but when I return a few days later to play Radiohead again, the sorting is not maintained.  It could be as simple as sorting in a descending direction, or could even be trying to sort by the number it was added in my library.
    I'd really appreciate it if someone knew of a way (maybe even through scripts if possible / the only solution) to eliminate this problem and have every (NOT just the artists who I've told iTunes to sort a specific way) artist sort that way.
    I don't know if my copy is just corrupt?  It may be, since for some artists it's started playing them in the above mentioned order they were added to my library even if I force a sort by album by year (i.e. it will go from playing a 2007 album to a 2002 album and not the 2008 album).
    Thanks!

    Andrew, I know I am extremely late to the party but I too use Grid View.  I had the same problem that you had but have found this to work for me.  I used it and it is still holding as my default sorting even after switching between the Artist page and Grid View.
    Once you are inside of the Artist page continue to click on the Album column until it shows Album by Artist/Year.
    That will give you each album sorted by the year instead of it randomly sorting it for you each time you leave an Artist's page and then back again.
    Hope this helps.

  • How do I create a dynamic parameter based on a formula?

    Hi,
    I've developed a report, in CR 11, that is parameterized based on the field "ticket_date".  I've created a Min and a Max formula so that I can select a date range. This works wonderfully. However, my date list is growing longer by the day and each day I have to run the report I need to scroll through an even longer list of date values. This will become increasingly impractical with each passing month and year.  I would like create a "Year" paramater and a "Month" parameter so that I can first select the Year, then the month(s), then the dates.
    When I attempted to create a parameter based on the formula, "Year (), the formula wasn't in the list of available values to create a parameter on.
    How can I address this requirement?
    thanks in advance!
    Mark

    Hi Abhilash,
    Looks like I was able to create a Year field in the Command - thanks for the tip!
    Before I close this off as answered can you take a look at two sets of SQL I wrote in the Command that I'm getting errors on and offer advice on where the error is occurring.
    Example 1
    The SQL I attempted to write must be close though:
    Select ft.sequence, ft.ticket_date, coff.office_name, comp.subscriptions_id from
    field_tickets as ft, company_offices as coff, companies as comp
    INNER JOIN jobs ON comp.companies_id=jobs.companies_id
    INNER JOIN field_tickets ON jobs.jobs_id=field_tickets.jobs_id
    LEFT JOIN company_offices ON jobs.company_offices_id=company_offices.company_offices_id
    Where comp.subscriptions_id=7.00
    When I attempt to save this I get an error:
    "Failed to retrieve data from the database. Details: Exception: Error Message: Java Heap Space"
    Example 2
    I get the error, "Not unique table/alias: 'custom_jobs_values'" for the following SQL Command
    SELECT companies., jobs., field_tickets., regions., customers., custom_jobs_values. FROM
    companies, jobs, field_tickets, regions, customers, custom_jobs_values
    LEFT JOIN custom_jobs_values ON jobs.jobs_id=custom_jobs_values.jobs_id
    INNER JOIN regions ON companies.regions_id=regions.regions_id
    INNER JOIN jobs ON companies.companies_id=jobs.companies_id
    INNER JOIN field_tickets ON jobs.jobs_id=field_tickets.jobs_id
    INNER JOIN customers ON jobs.customers_id=customers.customers_id and
    companies.subscriptions_id=4.00
    thanks!
    Mark

  • How to schedule a background Job based on events

    Hi,
    We are on 4.6 C.
    We have a background job that has two ABAP programs.
    We need to start the 2nd ABAP program only after the first one has run successfully.
    If the second ABAP program does not run, the the job should have a status "FINISHED".
    Help appreciated.
    Thanks
    Mala

    Hi,
    How to schedule a background Job based on events,please refer to the follow SAP help:
    You can use events that have already been defined, or you can create new events for scheduling background jobs.
    If you wish to use new events, do the following to implement the event scheduling:
    Define and transport the event as a user event with transaction SM62.
    You must define only event IDs; event arguments are not defined in the R/3 System. Instead, you specify event arguments when you schedule a job to wait for an event and when you trigger the event.
    If you define a new event, you must also transport it to your production systems. The event transaction does not have a connection to the transport system. Instead, you must create a transport request for the event yourself.
    Do this to transport an event:
    Create a transport request.
    Start the editor in the transport request and enter the following:
    R3TR TABU <table name> where table name is BTCSEV for a system event ID, BTCUEV for a user event ID.
    Press F2 with the cursor on the table name to call up the screen for specifying the table entries to transport. In this screen, enter the event ID’s that you have created.
    Save and release the transport request. Ensure that it is imported into your production system(s).
    To trigger an event, add:
    – the function module BP_EVENT_RAISE to your ABAP program, or
    – the program SAPEVT to your external script, batch file, or program.
    When your programs execute these keywords, an event will be triggered in the R/3 background processing system. The event-based scheduler is started immediately. It in turn starts all jobs that were waiting upon the event, subject to normal background processing restrictions, such as the requirement that the job has been released to start.
    Schedule the jobs that are to run when your events are triggered.
    You can schedule jobs for one-time start or to be started whenever an event is triggered.
    Regards,
    collysun

  • HT4798 i created my apple id account, verified but know i m unable to log on, it says incorrect password, i tried to reset via forgot password option but it does not send reset password page to my e- mail address, how can i get this sorted or delete my pr

    User created apple id account, verified but know she is unable to log on, it says incorrect password, she tried to reset via forgot password option but it does not send reset password page to here e- mail address, how can i get this sorted? or how can i get her whole apple account deleted and created new one using same e - mail address?

    The idea to jumpstart by change was not the smartest one, but gives you an opportunity to use that "temporary" account as permanent. You do not have a choice cause obviously despite you thinking that old account is no more -it does exist on Apple servers. And if you are unwilling to share your [email protected] with friend, just create one extra [email protected] for your friend. One suggestion - do not use gmail.

  • How to creat a Data provider  based on different fields in SAP BW ?

    Hi,
    Experts,
    There are  20 fields  of  Plant Maintainace  like : 
    SWERK
    BEBER
    STORT
    TPLNR
    EQUNR
    INGRP
    QMDAT   ---peroid
    STTXT
    QMDAT  - Date of Notification
    QMNUM
    QMTXT
    QMART
    AUSVN
    AUZTV
    AUSBS
    AUZTB
    AUSZT
    ERNAM
    QMDAB
    AUFNR
    I  want to creat a  Report based upon these fields  ?
    For that I h'v  checked the relevant Fields to the   existing standard  Datasource  in Bw side   &
    Checked  cubes   created  based upon these Datasource  in Bw side !
    i h'v found  some fields are  existing different cubes & some are  missing .
    How to creat a Data provider  based on different fields in SAP BW ?
    plz suggest      !!!!!!!
    Thanx,
    Asit
    Edited by: ASIT_SAP on Jul 15, 2011 6:25 AM
    Edited by: ASIT_SAP on Jul 15, 2011 6:27 AM
    Edited by: ASIT_SAP on Jul 15, 2011 12:37 PM

    Hi Lee, Please see below..
    DECLARE @Machine2 TABLE
    DispatchDate DATE
    INSERT INTO @Machine2 VALUES ('2014/02/01'), ('2014/02/02'), ('2014/02/03')
    DECLARE @DateFrom DATE
    SELECT @DateFrom = DATEADD(D,1,MAX(DispatchDate)) FROM @Machine2
    SELECT @DateFrom AS DateFrom
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • How to construct a standard rowKeyStr based on a value passed to a method ?

    Hi to all im on a proyect and i really appreciate some people can help with this
    looking ADF joins all use rowKey values and i need to know how to generate a standard rowKeyStr based on a value passed to an event, so it let me access any page on my Jsp ADF application and pass some values to a method and get the rowKeyStr.
    i have this method actually getting the current row, how i can generate a standard rowKeyStr value.
    public String myrowKeyStr(String id) {
    if (id != null) {
    PbeVisitasViewImpl vo = (PbeVisitasViewImpl)getPbeVisitasView1();
    Key k = new Key(new Object[]{id});
    Row[] found = vo.findByKey(k,1);
    vo.setCurrentRow(vo.findByKey(k,1)[0]);
    return someRowKeyStr;
    }

    once you do the
    Key k = new Key ( new Object[] { p1 } );
    The rowkeystring comes from:
    String strRowKeyStr = k.toStringFormat();
    Just type k. and press ctrl-space to see the list of methods.

  • Any ideas on how we could get any sort of shop stamp or other identifying mark onto our fillable pdf on an ipad.

    I am looking for any ideas on how we could get any sort of shop stamp or other identifying mark onto our fillable pdf on an ipad.
    The scenario is that when we do a job as opposed to our regular contract work, at a large nationwide retailer, their accounts people want the shop's stamp, as proof of the work being done.
    Currently the 'paper' service report is just stamped. For the regular contract work, whoever signs the service report just uses their finger to sign the report, on the iPad.
    On a PC the shop could just set up an electronic signature as their 'shop stamp', but the iPad is another story.
    I am having a vision of ink stamps all over the iPad screen. LoL
    Any ideas would be appreciated.

    Unlike the desktop version of Adobe Reader, Reader mobile products (for iOS, Android, Windows Phone) do not support stamp annotations yet.
    If you'd like, you can submit the Feature Request form.  The Product Management team will take your request into consideration for a future release of Adobe Reader for iOS.
    Thank you for the feedback!

  • I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    I-photo:  I used 2 cameras to take pictures on a trip --- i have put the pictures from both cameras into an album --- when i click on view and then sort by date, the pictures do not sort by date --- any ideas on how to get the pics sorted by date?

    Select all the photos that you need to change, then click the "Photos" menu and choose "Adjust Date and Time".
    If you add a year, it will adjust all the photos that you selected by adding a year (so if you accidentally select one of the photos that already has "2012", that will change to "2013"). 

Maybe you are looking for