Sorting a crosstab

Post Author: foghat
CA Forum: General
Hey all,Is there anyway to sort the crosstab rows based on the summary field total in a crosstab? I have a crosstab report which displays Account Description as the rows, Production Months as the columns, and an @Operating Cost formula as the Summarized Field.  The @operating cost formula is: IIF ({NOI_REPORT.CLASS_CODE} = 'EX',{NOI_REPORT.CC_TOT_AMT} ,0 ).  The crosstab is currently sorting by Account Description in ascending order.  I would like to sort the Account Description based on the Total (as calculated at the last column) @operating cost in descending order.  Essentially so that Account Descriptions with the highest operating cost display first.

Post Author: foghat
CA Forum: General
Right, I should have mentioned I tried that.  It will only let me sort based on the row (Account Description) field.  I want to sort based on the summarized field (@operating costs).I have also tried adding @operating cost to the Record Sort Expert, not surprisingly that doesn't work either.Thanks for the suggestion.

Similar Messages

  • Sorting a Crosstab by "GL Period Number" but Showing "GL Period Name"

    We are trying to create a report that has "GL Period Name" (JAN-09, FEB-09, MAR-09") across the top but the report sorts them by Alpha giving us:
    FEB-09, JAN-09, MAR-09
    We are even trying to use "GL Period Number" to get the Numeric order but to not want to display it.

    Hi Chris
    You need to create an alternate sort for the Period Name using the Numeric order as the alternate.
    You do this in the Admininstrator tool by creating a list of values for the Period Name, perhaps against a Custom SQL folder, and then assigning the LOV to the GL Period Name by editing the Property called Item Class.
    In Custom SQL you can use something like this:
    SELECT DISTINCT PERIOD_NAME
    FROM
    table_with_period
    ORDER BY
    numeric_value
    You create an Item Class (aka list of values) on the PERIOD_NAME in this folder. When creating the item class make sure you uncheck the box which says Sort and remove duplicates. This is already being done by the Custom SQL.
    With the Item Class built, go to the GL_PERIOD_NAME, right-click on it and select Properties.
    Look for the Item Class property (its about half way down the list) then click in it. From the list of available Item Classes pick the one that was created against the Custom SQL folder.
    Hint: a good idea would be to create a new business area called LOOKUPS and place all your custom lists of values in here. Only the administrator would have access to this area. However, any item class built against an object in here will be available for use in your real business areas. In order to make the assignment in Discoverer administrator you will need to have the LOOKUPS business area open as well as any business area you will be attaching the item class to.
    Hope this helps
    Best wishes
    Michael

  • Sorting Crosstab By Summaerized Fields

    Hi,
    I have a fairly strightforward crosstab. The data is has RptGroup for rows and has 4 summarized fields
    Avg of @ComplianceYN
    Count of Command.MRN
    StdDev of Command.Persistence
    Avg of Command.Persistence
    The crosstabs default order is by RptGroup. The user would like to see it sorted by Avg of Command.Persistence.
    I can't find any way in the crosstabe object to to this.
    Can you help?
    Thanks,
    Dick Rosenberg

    Hi Sastry,
    Now I am more confused than ever.
    I made another report that was essentially the same as the first report. When I got to the crosstab I thought I would do the same thing you suggested for the first report, create a formula, Average of Persistence, that was average({Command.Persistence}), put that in my crosstab as a column, then go into Group Sort Expert and sort on my formula.
    Well it doesn't work and the symptoms are very confusing.
    In my first report, after I put the formula Average of Persistence as a column in my crosstab, as you predicted, there were a lot of extra columns in my crosstab. As I recall (this happened a couple of days ago), I deleted one of the new labels from my crosstab and all of the new columns disappeared.
    Yet I was able to find the Average of Persistence formula in the Group Sort Expert and when I previewed the report, the crosstab sorted in the same order my chart. So I was happy.
    Today I copied the report to a different name (same command) and went about changing the Chart and the crosstab to represent the new grouping (it is the same data but charted and crosstabbed by a field in the command called Team as opposed to the first report which was charted and crostabbed by a field in the command called Reporting group).
    I was able to sort the chart easily enough, but I can't sort the crosstab in the order of Average Persistence. So I went back to look at the first report to see what I had done. I discovered that the formula Average of Persistence was not in the columns in the crosstab on the first report (which probably happened when I deleted  all of the fields in the crosstab that appeared when I put in the column ).
    Yet the crosstab in the first report still sorts in the correct order, by Average of Persistence.
    And, no matter what I do, I can't get the second report to sort that way.
    So I feel like I'm back to square 1 - I don't know what I did in the first report to get it to work and I can't get it to work in the second report no matter what I do.
    Help!
    Thanks,
    Dick

  • Sorting a cross tab total

    I am a newcomer (user) to Discoverer so would appreciate some help.
    I have written a cross tab report which shows my sales people in the rows and different sales catagories in the columns. I have then put a total on my rows (total for each sales person) which works fine.
    I then want to sort my sales people by their "total sales" ie my calculation.
    Looking in the sort functionality I appear to only be able to sort the sales people by each of the actual columns of data which come back in the report (ie the sales categories - cat 1 or 2 as below)
    E.g
    Cat 1 Cat 2 Total
    Sales Man 1 10 15 25
    Sales Man 2 15 30 45
    I want to sort so that the 45 is viewed and Sales Man 2 is sorted to the top.
    Help?
    Ed

    Hi,
    Sorting a crosstab how you want is always difficult. If you only ever want two categories as column headers then it will be easier to use a table report and decode out the categories and sort by the total.
    Otherwise you will have to use a analytic sum with a partition to calculate the total for each sales in a calculation and then include that calculation as a dimension. You will then be able to sort the crosstab using this dimension and if necessary hide the content of the field using formatting.
    Rod West

  • Query to get combinations of column values

    -- Input Data
    with t as (select 'H' as symbol, 1 as id from dual union all
              select 'H' as symbol, 2 as id from dual union all
              select 'H' as symbol, 3 as id from dual union all
              select 'H' as symbol, 4 as id from dual
    ,s as (select 'L' as symbol, 1 as id from dual union all
              select 'L' as symbol, 2 as id from dual union all
              select 'L' as symbol, 3 as id from dual union all
              select 'L' as symbol, 4 as id from dual
    --select * from t,s
    [pre]
    -- Required output is four columns with the below values. The column headings are the ids from the original query. Therefore I suspect the solution would have some sort of crosstab..
    id1---id2---id3---id4
    HHHH     
    HHHL          
    HHLH     
    HHLL                    
    HLHH     
    HLHL          
    HLLH     
    HLLL     
    LHHH     
    LHHL          
    LHLH     
    LHLL                    
    LLHH     
    LLHL          
    LLLH     
    LLLL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    select REPLACE(sys_connect_by_path(symbol,'-'),'-','' ) "id1---id2---id3---id4"
    from (select*from t union all
    select*from s)
    where connect_by_isleaf = 1
    start with id=1
    connect by prior ID=ID-1
    ORDER BY 1
    I THINK U WANT THIS ........
    select substr(regexp_substr(scbp, '-[^-]*', 1, 1),2) as ID1,
    substr(regexp_substr(scbp, '-[^-]*', 1, 2),2) as ID2,
    substr(regexp_substr(scbp, '-[^-]*', 1, 3),2) as ID3,
    substr(regexp_substr(scbp, '-[^-]*', 1, 4),2) as ID4
    from (
    select sys_connect_by_path(symbol, '-') scbp
    from (select*from t union all
    select*from s)
    where connect_by_isleaf = 1
    start with id=1
    connect by prior ID=ID-1
    Edited by: user12108669 on Nov 12, 2009 9:42 PM
    Edited by: user12108669 on Nov 12, 2009 9:43 PM

  • Sorting column name in crosstab report 10.1.3.2.1

    hi,
    i have crosstab report build with bipublisher 10.1.3.2.1.
    in column, i have jan'11 feb'11 etc but not sorted correctly(it should be ordered by numeric not character).
    any advise will be higly appreciated.
    thx.
    regards,
    tyo

    You need to either convert these to a date in canonical format and sort based on date,
    Or convert these months to number and sort based on number to have the months sorted correctly

  • Sort order help for date string in crosstab

    Hello All,
    I need to calculate the number of calls for service for the last 13 months. Display the number in the report footer by month and year in a grid similar to a crosstab and in ascending date sort order. 
    Example: 
    May 2008    1,400
    Jun 2008     1,287
    Jul 2008      1,290
    all months through last full month 
    May 2009    1,385
    I can calculate the number of calls per month and display the month and year by converting the month and year to text.  However, I cannot seem to find a way to sort the month and year without some kind of on-going manual intervention.  I need to make the report maintenance free for monthly scheduled e-mail distribution in business objects enterprise.  Specified order does not work since the column headers will change each month.  It needs a sort order formula, but I am not sure how can this be done inside a cross tab? 
    Any help or suggestions are appreciated!
    Thanks,
    Wendy Douglass

    Hi,
    I have a similar cross tab in my report. but only problem is grouping is done based on a parameter GroupBy, which has Day, Week, Month values.
    if user selects day or week, cross tab should display column in dd/mm/yy format, if its month, MMM-yy format.
    I have created a date formula ,  GroupBy = Day then Opendate
                                                       GroupBy = Week then opendate -dayofweek(opendate)+1
                                                       GroupBy = date(year(opendate),month(opendate),1)
    and used this date formula as column in cross tab. I tried to format using custom date style...but its not working in cross tab.
    if I use totext to format the date formula, data will not be in sorted order...ex, its showing jul-99 before jun-99
    can anyone help?
    Thanks in Advance,
    Jyothi
    Edited by: Jyothi Yepuri on Jul 8, 2009 5:27 AM
    Edited by: Jyothi Yepuri on Jul 8, 2009 6:10 AM

  • Crosstab specified sort order

    Post Author: Jan_Hauptmann
    CA Forum: Crystal Reports
    Hi,I am quite new to Crystal Report (XI), especially crosstabs. Currently I am trying to create a crosstabwhere selected customer are shown on the top of the crosstab and all not selected to be counted as 'Other'. This is no problem as long as I have always the same customer I want to show(via Cross-Tab goup option - specified order). But what I would like is to enter the customer via the parameters and than apply it as specifiedsort order and all not mentioned customer from the parameters to be calculated as 'others'. Is there any chance to achieve something like this? Thanks in advanceJan

    We are experiencing a similar issue with the sort order in Infoview. We are using Crystal XI.5.8.26 and Infoview.
    The specified sort order works correctly in Crystal but in Infoview it comes back with a different order. Are there any suggestions on resolving this disparity?
    Thank you.

  • Crosstab: Sort Descending by Row Total

    Good Morning,
    I've created a simple Crosstab that documents qty per CPT code for each of 3 reporting periods.  Currently, the crosstab sorts records by CPT code which is my only row field.  My column field is formula based on discharge date (3 separate reporting periods.  The data is Sum of Quantity field. 
    While the report is functional, I need to go one step further.  The user would like the report sorted on total quantity in descending order.  That is, the CPT with the highest grand total quantity is to be shown at the top of the report. 
    Can anyone suggest the best approach to solving this challenge?
    Thanks for your help!!

    Wow, That was quick and easy.
    Thanks for the help...I probably should have noticed that in the first place.

  • Sort By Month Name in Crosstab report

    Hi,
    I have one cross tab report in which in Datapoint I have one column which shows Month Details. When I run the reports the heading of Column comes as Month Name (ie Aug, April, Dec,.....) . Can you please help me to understand how can it be done it displayed in sorted month according to Month Name (ie. Jan, Feb, Mar, Apr.......). As per one of the Thread I tried to use to_date(Column_name) but it does not work as Column name is char column and cannot be converted to date.

    Hi ,
    What if you use the following ...in bold?????
    SQL> select ename,hiredate from emp;
    ENAME      HIREDATE
    SMITH      18/12/1980
    ALLEN      20/02/1981
    WARD       22/02/1981
    JONES      02/04/1981
    MARTIN     28/09/1981
    BLAKE      01/05/1981
    CLARK      09/06/1981
    SCOTT      18/04/1987
    KING       17/11/1981
    TURNER     08/09/1981
    ADAMS      21/05/1987
    JAMES      03/12/1981
    FORD       03/12/1981
    MILLER     23/01/1982
    14 rows selected
    SQL> select hiredate , to_number(to_char(hiredate,'MM')) from emp order by 2;
    HIREDATE    TO_NUMBER(TO_CHAR(HIREDATE,'MM
    23/01/1982                               1
    20/02/1981                               2
    22/02/1981                               2
    02/04/1981                               4
    18/04/1987                               4
    21/05/1987                               5
    01/05/1981                               5
    09/06/1981                               6
    08/09/1981                               9
    28/09/1981                               9
    17/11/1981                              11
    18/12/1980                              12
    03/12/1981                              12
    03/12/1981                              12
    14 rows selectedOR ....
    EVEN BETTER AS YOU NEED THE MONTH NAME....
    SQL> ALTER SESSION SET NLS_DATE_LANGUAGE='AMERICAN';
    Session altered
    SQL> select hiredate , to_char(hiredate,'MON') , to_number(to_char(hiredate,'MM')) from emp order by 3;
    HIREDATE    TO_CHAR(HIREDATE,'MON') TO_NUMBER(TO_CHAR(HIREDATE,'MM
    23/01/1982  JAN                                                  1
    20/02/1981  FEB                                                  2
    22/02/1981  FEB                                                  2
    02/04/1981  APR                                                  4
    18/04/1987  APR                                                  4
    21/05/1987  MAY                                                  5
    01/05/1981  MAY                                                  5
    09/06/1981  JUN                                                  6
    08/09/1981  SEP                                                  9
    28/09/1981  SEP                                                  9
    17/11/1981  NOV                                                 11
    18/12/1980  DEC                                                 12
    03/12/1981  DEC                                                 12
    03/12/1981  DEC                                                 12
    14 rows selectedRegards,
    Simon
    Message was edited by:
    sgalaxy

  • Sorting a variance column in Webi report

    I have the need to sort a report by a variance that I have calculated in the report.
    For example, a report has inventory for end of prior month and current day. I am calculating the variance between the two columns. (how much inventory has changed by product)
    I need to be able to sort this table descending so that I can see the big inventory movers first.
    When I select the variance column, the sort options are disabled.
    I have also tried to save my function as a variable and that does not seem to help.
    I am using WEBI XI 3.1.
    Any ideas?
    Thanks in advance.

    Rodney,
    The "column" parameter is used as such:  ;col which is added to the end of your formula like this:
    ([Stock Quantity] Where([Calendar Day]=Max([Calendar Day]) In Report) - [Stock Quantity] Where([Calendar Day]=Min([Calendar Day]) In Report);col )
    When you add the ";col" portion it tells WebI to calculate by column (the alternative keyword to this parameter is "row").
    You mention that you'll lose your calculated column, however, instead of building a formula with a cell, you can also construct a local variable to the report executing the same formula.  This method is handy when you'll have the same computation to do in perhaps several tabs, and you just want to code once and reuse in multiple places within your report.  So, if you can somehow work on establishing a local variable with the same formula, then demote the table to a horizontal or vertical table, put your objects in that grid configuration, apply sorts, then reposition as crosstab, you might be able to achieve your desired results.
    Thanks,
    John

  • How to avoid crosstab - Show number of days according to groups

    Morning all,
    I think you all would agree with me that even having crosstab as a great tool in Crystal 2008, there are still quite allot of limitations to it.
    I have created a report using crosstab which shows number of days and jobs according to those days grouped by account number, product code, sales area. This report is working fine until my director asked me to further group those days according to sub categories of lenses.
    For example
    Crosstab shows
    Number of days - Day 1,day 2, day 3
    Number of jobs - 111----123--1213
    Percentage - -
    12%---34% 60%
    Now if you look at the example it says day 1, 111 jobs went out. What the director would like to see is those jobs being sub divided into types of lenses.
    So out of 111 jobs, 25 would be Finished lenses, 30 could be uncut lenses and so on.
    The new report should be like this
    Number of days -
    Day1---Day2---Day3
    Number of Jobs:-
    Finished -
    25--34-----23
    Uncut--3045-----23
    AR--7056-----76
    Total----125135----122
    Percentage:-
    Finished -
    25%--34%-----23%
    Uncut--30%45%-----23%
    AR--70%56%-----76%
    Total----100%100%----100%
    Now if we look at the above criteria it seems that I have to use groups even further down the report where I am using crosstab at the moment. This means I have to get rid of the crosstab and run a report manually.
    However the big question is, how to get the report calculating number of days and jobs according to customer account number, product code and sales area manually?
    I tried the following formula but this requires to write way too many formulas, for example some of the jobs have taken more than 60 days and if i use this formula I have to write 60 formulas for number of days which is not feasable.
    **//provided by IIbas in another forum**
    whileprintingrecords;
    numbervar day0;
    numbervar day1;
    numbervar day2;
    if {@workingdays} = 0 then
    day0 := day0 + 1 else
    if {@workingdays} = 1 then
    day1 := day1 + 1 else
    if {@workingdays} = 2 then
    day2 := day2 + 1 else //up to the maximum number of days.
    Then in the report footer, reference the days in separate formulas, and identify them with text boxes, e.g.,
    //{@day0};
    whileprintingrecords;
    numbervar day0;
    I can sort out the Finished, uncut,AR by grouping them however I am wondering how to create a manual running total of jobs complying with number of days without using crosstab.
    Any ideas?
    Many thanks
    Regards
    Jehanzeb

    no answer closing

  • 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

  • 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

  • Display Month verbiage on chart but sort by month number

    Hello,
    I have inserted a simple bar chart (values by month for a single year) and my goal is to get the data values to group by month.
    I found that I can achieve this by using a formula that extracts the month from my Date/TIme field MONTH({Command.OB_DELIVERY_DATE}).
    This works OK and displays months as 1, 2, 3,  etc. on my chart), but I want to display the month text instead (Jan, Feb, Mar)
    I tried a second variable:  ToText({Command.OB_DELIVERY_DATE},'MMMM')
    This works in displaying the verbiage of the months, however, the problem is that it groups the months on my chart alphabetically now (April is now my 1st month instead of January).
    What is the trick to displaying month verbiage on my chart, but still sorting these months in their proper numerical order?
    Many Thanks!

    Hi Dave,
    Try this please:
    1) Insert a Crosstab and place it on the Report Header. Use the Delivery Date field as the row and add the measure field as the Summary Field with the right Sum function
    2) Highlight the Delivery Date field > Group Options > set it to print 'For Each Mointh'
    3) While in the Crosstab Expert highlight the Delivery Date field > Click Group Options > Options  tab > check the option 'Customize Group Name field' > Select 'use formula as group name' and click the formula button beside. Use this code:
    ToText({Command.OB_DELIVERY_DATE},'MMMM')
    4) Right-click the Crosstab and select Insert Chart. Choose the right Chart Type
    5) Suppress the Section that holds the Crosstab
    Hope this helps.
    -Abhilash

Maybe you are looking for