Averaging in a Crosstab

Post Author: jmlightbody
CA Forum: Formula
I need to average the number of orders for each day(in my crosstab), but I cant select the date & set the summary to Average.....
Suggestions?

Post Author: jmlightbody
CA Forum: Formula
OK, a little more specific.
I'm using Crystal XI.
My report is grouped by date.
I have a crosstab on Rpt-footer that has distinct counts of orders by day-of-week.
I also want to show average orders per day of week....do I have to do it manually? or can I do it in the crosstab?
When I try to insert the OrderID & change summary to Average...that option is not available.

Similar Messages

  • Crosstab YTD averages problem

    Pulling a large set of customer contacts (100,000s of rows) with each row being a contact. I have a crosstab which groups by location and employee, when the detail rows are the types of contacts (in person, telephone, etc) and then I have months across the top. Here's the problem I'm having:
    I need to calculate the average # of contacts per business day. I could countdistinct(contact_date) if I were basing the average on the number of days on which contacts occured (for each dept), but the report has to calculate averages for all departments based on the same # of business days per month (21 in January, 19 in February, etc.). If I just put the number of days on each row in the dataset, I could do min or max or avg and it would work fine for the months' averages, but the totals at the end for YTD won't work. I can't sum, because I have the # of business days on each row, so 1000 contacts in a month with 21 days would put a denominator of 21000.
    This is how it would look working the way I want it to.

    Thank Graham,
    when i use the same technique of setting up a nested counter and highlighting the fields based on that value...
    The counter should be set on every column of the row?
    It is because i found there is the problem, when i set the counter on every column...all the row will be highlighted without condition (x<=5), i think the counter may overcounted or not work.
    for example..
    user   action count
    1. a     10
    2. b     9
    3. c     8
    4. d     7
    5. e     6
    when i set the counter (let's say x<=2), on both user and action
    i will see the user 1,2 had been highlight and whole action column as well.
    and i also struggling with the filtering..
    i saw the whitepaper, can it apply in the crosstab?

  • Use average of crosstab columns in a calculation in the crosstab.

    Using XI R2  I have a crosstab where I need to have the average weeks sales i.e. the sum of one row divided by the number of columns. I've done this in two ways -
    =Average([Forecast Weeky Qty]; IncludeEmpty)
    =[Forecast Weeky Qty]/Count([Forecast Weeky Qty])
    both of which return the correct value provided it is displayed in a cell outside the crosstab. The problem is if that variable is used in the crosstab it just displays the [Forecast Weekly Qty] for that column i.e. it's not doing the calculation at summary level as I need.
    How can I create an average that will display in the crosstab as the same figure in each column (the overall average) and can therefore be used to calculate another row in the crosstab?
    eg
    Sales - 50, 50, 75, 25, 50    should give average of 50. What I get when I put it in crosstab is
    Avge - 50, 50, 75, 25, 50    WRONG.  What I want is
    Avge - 50, 50, 50, 50, 50
    Thanks
    John

    No, your query doesn't work as illustrated below. Your SQL returns views. Your SQL returns rows that have data that isn't null in them because it relies on the table analyze data which will be out of date when the query is being run.
    select * from user_tab_columns u
    where u.HIGH_VALUE is null;
    no rows selected
    SQL> CREATE TABLE test1
    a    NUMBER
    Table created.
    SQL> select table_name from user_tab_columns u
    where u.HIGH_VALUE is null;
    TABLE_NAME
    TEST1
    SQL> CREATE VIEW test_view AS
    SELECT * FROM test1;
    View created.
    SQL>
    SQL> select * from user_tab_columns u
    where u.HIGH_VALUE is null;
    TABLE_NAME
    TEST1
    TEST_VIEW
    SQL> INSERT INTO test1 (a) VALUES (1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from user_tab_columns u
    where u.HIGH_VALUE is null;
    TABLE_NAME
    TEST1
    TEST_VIEW
    SQL> select * from test1;
             A
             1
    SQL>

  • Average no value in crosstab report (Discoverer Desktop)

    Hello experts,
    I have a crosstab report, and i want to use avg to a calculation field, but in crosstab i have no values and when i make drill down i have values under my group.
    how can i solve this?
    Edited by: user13062021 on 18-Feb-2011 07:44

    I make this change to my values "nvl(<item>,0) but nothing happened. In discoverer plus the values are correct but in discoverer desktop the values are null.
    Instead of this in analytical sheet i do not have null values to this column.
    For your information,
    in analytical sheet i have a calculation field with round and nvl functions, and i calaculate this field from the analytical sheet to crosstab sheet with an AVG() function, and cannot claculate.
    When I first make this sheet the values in discoverer desktop are all correct, but on the other day when I make refresh to my sheet the values are null.

  • Daily average report

    I need to design a Crystal report that shows the average number of scheduled appointments per day in the next 4 weeks.
    (This will be a rolling weekly report.)
    The fields I am working with are "ApptDateTime" and "PatientNumber"  (Our database has no "ApptDate" field, so I usually work around this by using a parameter)
    The results should look like this:
    WEEK of
    Mon
    Tues
    Wed
    Thurs
    Friday
    AVERAGE# Appts
    Aug 4
    2
    2
    2
    2
    2
    2
    Aug 11
    4
    2
    4
    3
    4
    3
    Aug 18
    5
    2
    5
    2
    1
    3
    Any help would be greatly appreciated!

    Hi,
    A crosstab, as Brian suggests, is the ideal way to go about building such reports. Do note however, that it will skip any rows/columns that doesn't have any data in the database.
    You don't want a crosstab that doesn't show the Weekday just because there aren't any appointments for that day for the next few weeks (very rare situation in my opinion).
    It is still worth covering up for the not-so-obvious. You'll need to build a table in the database with a DateTime column that list all dates for perhaps the next two or more years and LEFT JOIN it to the existing ApptDateTime field. Throughout the report, wherever you've referenced the ApptDateTime field, replace that with the DateTime field from the new table.
    Once you have the above sorted out, you have some more work before the Crosstab is ready. Here's what you need to do (Steps work only for CR 2008 or higher):
    1) Add the record selection formula so that it gives the weekends a miss:
    Not(datepart('w',{DateTimeField}) IN [1,7])
    2) Create a formula called 'DayName' with this code:
    datepart('w',{DateTimeField})
    3) Insert the crosstab. Use the DateTime field as the Row and set it to the Print 'For each week' by clicking the options button
    4) Use the 'DayName' field as the Column > Click Group Options > Options tab > Click 'Customize Group Name field' > Click the formula button beside 'Use a formula' and use this code:
    WeekDayName(datepart('w',{DateTimeField}))
    5) Use the PatientNumber field as the Summarized Field and change the Summary to 'Count'
    6) Refresh the report and while in the Preview Mode, right-click the 'Total' Column > Select Column Grand Totals > Check 'Suppress Grand Totals'
    7) Right-click column header for 'Friday' and select Calculated Member > Insert Column. A blank column with zero values is inserted
    8) Right-click the blank header cell > Calculated Member > Edit Header Formula and type this:
    "Average # Appts"
    9) Next, Right-click one of the zero value cells in the newly added column > Calculated Member > Edit Calculation Formula and use this code:
    local numbervar i;   
    local numbervar avg;   
    local numbervar cnt;  
    for i := 0 to CurrentColumnIndex-1 do   
        avg := avg + (GridValueAt(CurrentRowIndex, i, CurrentSummaryIndex);   
        cnt := cnt + 1;   
    avg/cnt;
    Let me know how this goes.
    -Abhilash

  • Calculation based on totals in Crosstab

    Hi,
    I have the following crosstab.
    Vendor 1234
         Dc Nbr 1     2     4     
    Sum Invoice Amt      1387.04     300.82     327.29     2015.15
    Sum Cost 44.86 57.43     25.54     127.83
    Sum Advanced Cost     102.44     0     0     102.44
    Sum Consolidation Cost     30.37     0      0     30.37
    Sum Allowance Amt     27.74     6.02     6.54     40.30
    Net Freight Cost     149.93 51.41     19     220.34
    Freight Percent     10.81     17.09     5.81     ****
    The last column are Row totals for those fields.
    What I need is how to get the **** to be 10.93 which is the Freight Percent calculation value based on the Total Column fields. The
    Frieght Percent field is calculated as follows for the rows.
    ( NVL(Sum Cost,0)+NVL(Sum Advanced Cost,0)+NVL(Sum Consolidation Cost,0)-NVL(Sum Allowance Amt,0) )/NVL(Sum Invoice Amt,0)*100                         
    I have tried to do the Row Total with Average, Sum, etc, but not getting the answer we need.
    Table structure is 3 rows per vendor with 1 row per dc nbr.
    Any help would be greatly appreciated.
    Thanks
    Edited by: clifford_d on Dec 4, 2008 9:46 AM

    See if this explains it better for my crosstab with page items of Vendor Number 1234.
    Vendor 1234
    Dc Nbr 1 2 4 AAAA
    Sum Invoice Amt 1387.04 300.82 327.29 2015.15
    Sum Cost 44.86 57.43 25.54 127.83
    Sum Advanced Cost 102.44 0 0 102.44
    Sum Consolidation Cost 30.37 0 0 30.37
    Sum Allowance Amt 27.74 6.02 6.54 40.30
    Net Freight Cost 149.93 51.41 19 220.34
    Freight Percent 10.81 17.09 5.81 ****
    As stated before, Frieght Percent is a calculation I created in Discoverer that looks like this :
    ( NVL(Sum Cost,0)+NVL(Sum Advanced Cost,0)+NVL(Sum Consolidation Cost,0)-NVL(Sum Allowance Amt,0) )/NVL(Sum Invoice Amt,0)*100
    Column AAAA was created in Discoverer using Sum of field and show to the right.
    What I need is for the **** to be the correct calculation for the totals in column AAAA. If I use do a total for Freight Percent using the Cell Sum I get 33.70., what I want is it to be 10.93, which is (127.83 + 102.44 + 30.37 - 40.30)/2015.15*100.
    If I use an Average Total row for Freight Percent, I get 11.24 which is 33.70 / 3 (the 3 would be the # of dc nbr's)
    I did start with using the detail level data to create this crosstab. Then I made a new version and used the SUM data. I seem to get the same results but am still having issues with the one **** value.
    Hopefully this explains it better.
    Thanks for the ideas so far.

  • Moving Average

    Hello all I am in need of some help. I have a crosstab that I am trying to get a moving average at the bottom of the report. Current my crosstab is counting how many titles were completed in a week, columns show the week beginning, rows show the stage the titles are in. I only want to calculate one row, Example: week 1 19 titles complete, week 2 12 complete, week 3 18 complete and week 4 11 complete. SO under week 4 I want a new cell showing the average for the 4 weeks (19+12+18+11 / 4 = 15) then when we hit week 5 I want a cell under week 5 showing the average for weeks 2 thru 5 and so on.
    What I have done so far is added a new row at the bottom of the crosstab, I am not sure what the formula will be that I enter into the Calculated Member. Any and all help is much appreciated.

    You can surely round up.
    Use this code:
    local numbervar i;
    local numbervar avg;
    If CurrentColumnIndex+1 >= 4 then
        for i := CurrentColumnIndex-3 to CurrentColumnIndex do
            avg := avg + GridValueAt(currentrowindex-1, i, CurrentSummaryIndex);
        Round(avg/4);
    else
    0;
    -Abhilash

  • Hope to have crosstab result

    I have following SQL to get weekly average,
    SELECT next_day(dt-1,'FRIDAY') FriDate,avg(midpoint),commodity_id,location_id
    FROM price where location_id in(50,22,33,48)
    and commodity_id in(7,7,12,8)
    and dt>=to_date('4/12/1996','mm/dd/yyyy')
    and dt<=to_date('12/31/2000','mm/dd/yyyy')
    group by next_day(dt-1,'FRIDAY'),commodity_id,location_id
    result like this:
    FRIDATE     AVG(MIDPOINT)     COMMODITY_ID     LOCATION_ID
    4/12/96     222     7     22
    4/12/96     212     7     33
    4/12/96     217     7     50
    4/12/96     495     12     22
    4/12/96     490     12     33
    4/12/96     485     12     50
    4/19/96     222     7     22
    4/19/96     211.2     7     33
    4/19/96     217     7     50
    4/19/96     481     12     22
    4/19/96     474     12     33
    I wold like to have crosstab report as following
    FRIDATE     AVG(MIDPOINT) of COMM_ID(1)LOC_ID(1) AVG(MIDPOINT) of Comm_ID(2)Loc_ID(2)....dynamic showing both ID on field title
    4/12/96     222(7,22)      212(7,33).....show average(not the ID)
    4/19/96     222(7,22) 211.2(7,33)
    How I change the query to achieve this.
    Thanks

    The processor can be upgraded; it is socketed. However, virtualization must be implemented in the motherboard and BIOS and without that, upgrading the processor will do no good. Which processor do you have?
    Here is the Service Manual:
    Manual
    See page 120....virtualization is possible on some models but I am going to assume only the models with a Core2 Duo processor. Celeron and Pentium Dual models use a different chipset on the motherboard so even if you put in a Virtualization capable CPU it would not work.
    If this is "the Answer" please click "Accept as Solution" to help others find it.

  • Above Average Conditional Formatting in Pivot Table off Row Total

    I have a pivot table where the months are column labels and the actual issues are Row labels. This is inverted from a normal pivot table where the months are usually the row labels.
    Basically I want the table to look at the value in the Values cells to look at the row Average instead of the column Average. Is there a way to do this?
    I've highlighted all my Value cells (showing the sum of the issue for a specific month) and then applied the Above Average conditional formatting selecting 'All cells showing "Average of #of Tickets" values for "Issue" and "Month".
    This works where the cells' value is greater than the columns average, but I want it to look at the row average instead.
    Is this possible? I thought it be simple, but I can't figure it out. The table will grow every month width wise and possibly adding new issues each month.

    Hi Vetsrini, thanks for the reply. I'm using the crosstab feature of BI Publisher template builder in MS Word to create the pivot table. I have a field called ACTIVITY as the row, and I want to bold the font and set the color as red if the ACTIVITY equals to certain text (such as if ACTIVITY = 'A' then bold & red). Can you please tell me how that can be achieved? I tried using the conditional formatting feature of the template builder, but it only works if I use it in a table, and not in pivot table.
    Thanks a lot.

  • Ranking in crosstab but for one coloumn

    could you please help me on this?
    my month dimensions are on the top of my Crssstab chart, my product dimesions are on the left of my crosstab chart. there are sales revenue measures inside of the my crosstab chart. whenever I try to ascend my crosstab datas, it average all the months and put it in order. I dont want it to do that. what I want is this, It has to pick the last month and put it in order and it also has to pick the other months and put it in order based on the last month.

    Hello,
    Ranking has to be on a measure. So you could make a variable as a measure of the Date field, and then place that as the top header of the crosstab and do a top 5 or however many you need descending ranking of that object.
    Does that make sense?

  • Averaging Columns (by months of the year)

    Running Oracle 9i
    I have this query which takes fields: ID, Date, and Data and performs a crosstab (matrix) query which has the day column, the 12 months, and the total for each day.
    I have been trying to add averaging for each month at the bottom of the result and total after that so that the result looks like:
    Day Jan Feb Mar ... Oct Nov Dec Total
    1 1.1 2.2 3.3 4.4 5.5 6.6 999.99
    2
    30
    31 3.3 6.6
    (currently looks like the above.. Need to change query so that the next two lines are displayed)
    Average 2.2 4.4 ....... etc.. 5.5 (blank)
    Total 4.4 8.8........ etc... 11.0 999.99
    I tried to use an example of the ROLLUP and just got different errors..
    Here is the current query:
    select to_char(piDate,'dd') as day
    ,sum(decode(to_char(piDate,'mm'),'01',piValue)) as Jan
    ,sum(decode(to_char(piDate,'mm'),'02',piValue)) as Feb
    ,sum(decode(to_char(piDate,'mm'),'03',piValue)) as Mar
    ,sum(decode(to_char(piDate,'mm'),'04',piValue)) as Apr
    ,sum(decode(to_char(piDate,'mm'),'05',piValue)) as May
    ,sum(decode(to_char(piDate,'mm'),'06',piValue)) as Jun
    ,sum(decode(to_char(piDate,'mm'),'07',piValue)) as Jul
    ,sum(decode(to_char(piDate,'mm'),'08',piValue)) as Aug
    ,sum(decode(to_char(piDate,'mm'),'09',piValue)) as Sep
    ,sum(decode(to_char(piDate,'mm'),'10',piValue)) as Oct
    ,sum(decode(to_char(piDate,'mm'),'11',piValue)) as Nov
    ,sum(decode(to_char(pidate,'mm'),'12',piValue)) as Dec
    ,sum(piValue) as Total
    ,max(reportid) as ReportID
    ,max(waterdatatypeid) as WaterDataTypeID
    from LPInflow
    where reportid=14 and pidate >=to_date('2006/01/01','yyyy/mm/dd') and
    pidate <= to_date('2006/12/31','yyyy/mm/dd')
    group by to_char(piDate,'dd'),to_char(piDate,'yyyy');
    Also, the reportid is the same for all, but just using reportid instead of min/max reportid causes the query to fail..
    If I could get the correct query systax it would be great..
    Thanks .Very Much appreciated..

    Hi Swaroop,
                        I have a issue with allocation logic i.e is my scenario require allocation logic or i can write general logic,if yes,can you give a suggestion how to write..
    Scenario is..in my plan..
    I prepared a schedule for SALES planing...for which i have prepared a input scedule..
    My input schedule works like..COLs-SalesAccountits memberset isfiltered using propety i.e test3="C"
                                                     ROWs-ENTITY--its memberset is  filtered using propety i.e Plants="A"
                                                     Time--Taking from CV.
    When i take time 2009.INPUT from CV and enter the data for entity for respect salesaccounts and send the data.NEXT,
    I want to copy the same data to all the months of 2009...for that iam using allocation like
    *RUNALLOCATION
    *FACTOR
    //*USING
    *DIM ENTITY WHAT=Entity;                    WHERE=<<<:              USING=Entity.PLANTS
    *DIM SALESAccount WHAT=SALESACCOUNT;  WHERE=<<<:  USING<>SALESACCOUNT.TEST3
    *DIM TIME WHAT=BAS(%YEAR%.TOTAL); WHERE=<<<;          USING=%TIME_SET%;
    *ENDALLOCATION
    will it work my scenario does i need to add any other logic ...
    Suggest me sol..
    regards,
    Naresh.

  • Average Result of a data item not Average!

    I have chosen to install a Grand Total (at right) Columns Average of a calculated field, which is a data item in my crosstab report. The resulting values are always erroneous. The Sum(data-item) Total columns I use are accurate, but the Average Total is always wrong! Even if it counted null columns (hope not!) to divide the sum of the calculations by, it wouldn't be the figure it comes up with. Am I the first or just most recent to get bogus average results from a Total?

    Hello,
    I have this kind of problem either. First I thought, it migth be the statistical mean (sum/count-1) when using "calculate over all page items" - but this can also be a coincidence.
    When using "calculate only page items of this page" (sorry, don't know the exact label of the feature, I'm using a german version of Disco) then I get a number that is calculated as follows: sum over all items / count of distinct items of the attribute being most left on the crosstab.
    Example:
    Country City Number of x Number of y
    Germany
    Berlin 4 6
    Munich 5 3
    France
    Paris 3 3
    Lyon 4 2
    AVG 8 7
    What I want: 4 3,5
    There I get the average for the sum of all countries - but I want the average over all cities!
    Does anyone can give a hint? (workararound is to export in Excel - but that's not really what I want ...)
    THX!
    Greetings,
    Alex

  • Crosstab SUM behaviour query

    Hello,
    I have a crosstab report in Discoverer Plus which does not display the expected results.
    There are organisation areas down the side with their associated staff below (outline style). The data point is a calculation which shows their average monthly hours, so it's a numeric field with a multiply and division performed on it.
    When the report is expanded everything is fine. When it is collapsed the summed amounts for the orangisation levels with all the staff below them are incorrect. Instead of showing the summed amount of all the staff's average monthly hours, it shows a "sum distinct" amount.
    E.g. Expanded:
                   Average Hours
    Procurement      680
    A Smith         160
    B Jones         200
    C Walker        160
    D Brown         160Collapsed:
                         Average Hours
    Procurement          360In Discoverer Desktop the collapsed amount is correct.
    I have tried setting different aggregation behaviour for the worksheet in Disco Plus which did not make a difference. When I edit the calculation and try to re-add the numeric field, it does not give me the "detail" option when I expand it; there's only AVG, COUNT, MAX, MIN, SUM.
    Do you have any ideas what might be causing my problem?
    Thanks
    Hazel

    Hi,
    If this is working in Desktop but not in Plus, then I would try changing the aggregation settings in the pref.txt for Discoverer Plus. In particular, try changing AllowAggregationOverRepeatedValues to 1.
    Rod West

  • Crosstab drilldown

    Hi,
    I am facing strange issue with crosstab .  i was working on crystal reports 2008 version .  on old  i can make drilldown by calclation the average of some value whcih exist on the header , by this calcuation I can do drilldown from this value. but after upgrade to 2013 it stop working the average calclation  the drilldown avalibality have stoped  whcih also exit in the header.
    can anyone please advice what should i check ?
    Thanks

    Are you using SAP Crystal Reports, Developer Version for Visual Studio .NET, Service Pack 10?
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Summarizing Cross Tab totals as Average

    Hello,
    I have summarized fields in a cross tab report as sum of, however want to average the total of one of them- is there a way to do this?
    Thanks,
    WA

    Select the crosstab field. Right click and modify summary function to average. You can change it in the crosstab expert as well

Maybe you are looking for