2 Cross tab summaries divided by each other

I have a cross tab report that summarizes 2 fields, sum of amount paid and distinct count of customers.  The rows of the cross tab are grouped by revenue category, the columns are grouped by month.  Within each cell I would like to divide the total amount paid by the distinct count of customers.  See the attached image, I would like the quotient of the top number divided by the bottom number displayed to be displayed in each cell of the cross tab.
Any help is greatly appreciated.  FYI, I am fairly new with Crystal Reports so I apologize if this is not making sense or if I am not going about this the right way.
Thank you,
Matt

Hi Matt,
Here's what you need to do:
1) Right-click the second summary field in one of the cells (example would be number 166 for Row = 01) > Select Embedded Summary > Insert Embedded Summary
2) Next, right-click the 'Edit this formula' > Embedded Summary > Edit Calculation formula and use this code:
If GridValueAt(CurrentRowindex, CurrentColumnIndex, CurrentSummaryIndex-2) = 0 then 0 else
(GridValueAt(CurrentRowindex, CurrentColumnIndex, CurrentSummaryIndex-2) /
GridValueAt(CurrentRowindex, CurrentColumnIndex, CurrentSummaryIndex-1) )
-Abhilash

Similar Messages

  • Cross-tab - Comparing values from resultset (other than CurrentFieldValue

    Hi guys, I'm using CRXI Standard (eclipse plugin) and I have some trouble to customize my crosstab.
    Here is a example of what I'd like to do
    if ({MY_TABLE.FIELD_FLAG}="Y") then
         "FLAG SETTED"
    else
         ToText(CurrentFieldValue)
    I read some topics on this site that were discussing about that issue but none of them seems to have been resolved.
    References:
    http://diamond.businessobjects.com/node/568
    http://diamond.businessobjects.com/node/580
    So I would just like to know if one of you guys found a solution or a workaround to that problem
    Thanks
    Phil

    Hi guys,
    After reading your suggestion we tried coalesce however we did not see any improvement whatsoever.  Also thanks for the tips Lars.  What we did find was that if we used input parameters the performance was greatly improved.  Strangely the original case statement OR the coalesce both performed well when we restarted our server (we have seen strange issues with 68 like this) but only when running the entire raw SQL script inside SQL editor.  ie: if our calculation view contains 100 lines of code and we paste it into SQL editor it works great.  Alternatively if we reference the view directly like this;
    select * from "SYS_BIC"."CalcViewName" where condition = 'abc'
    This performance is bad.  If we parameterize the calculation view and change the way we reference the view like this it is now flying;
    select * from "SYS_BIC"."CalcViewName"
    ('PLACEHOLDER' = ('$$CONDITION$$', ''abc'''))
    This makes sense to me as it seems to be pushing the filter to the beginning of the query.  What does not make sense to us is why running the entire SQL directly in SQL editor (without parameters) works very fast as well.  It's only when calling the view directly via SYS_BIC that it becomes slow and then requires the input parameters.  You might then ask why we care, just put the input parameters in the view and call it done!  Well the issue is with Microstrategy tool that we are using which has limitation around multiple values in a single parameter.
    -Patrick

  • Percent in Cross-Tab report

    Post Author: merv
    CA Forum: General
      I created a cross-tab report with 2 column (col1 & col 2).  Is it possible for crystal to calculate the percent of  (col2/col1) in a new col.
    col 1
    col 2
    col 3 (col 2/col 1)
    A
    500
    450
    90%
    B
    60
    20
    33%
    C
    75
    70
    93%
    D
    66
    63
    95%
    E
    99
    21
    21%
    F
    25
    15
    60%

    Post Author: V361
    CA Forum: General
    Open Cross Tab Expert, near the bottom left you can select new formula, in there You can create a formula and add it to the cross-tab summarized fields.
    ( /)*100

  • Creating a Cross tab that contains fields with shared variables

    I am trying to create a cross tab in CR2008. I can get the field in the details but cannot choose it when trying to create a cross tab. Please help.
    Thanks.
    Shared numbervar MonHrs;
    Shared numbervar TueHrs;
    Shared numbervar WedHrs;
    Shared numbervar ThuHrs;
    Shared numbervar FriHrs;
    Shared numbervar SatHrs;
    Shared numbervar SunHrs;
    If dayofweek(today) = 1
        then {@CapacityTeamCount} * SunHrs else
    if dayofweek(today) = 2
        then {@CapacityTeamCount} * MonHrs  else
    if dayofweek(today) = 3
        then {@CapacityTeamCount} * TueHrs else
    if dayofweek(today) = 4 
        then {@CapacityTeamCount} * WedHrs else
    if dayofweek(today) = 5
        then {@CapacityTeamCount} * ThuHrs else
    If dayofweek(today) = 6
        then {@CapacityTeamCount} * FriHrs else
    if dayofweek(today) = 7
        then {@CapacityTeamCount} * SatHrs

    I don't use CR cross tabs as a matter of preference so I can't tell you if the shared variables are having an impact on their availability in the cross tab dialog or how to make the necessary adjustments...
    I can, however, tell you that you don't need a cross tab for what you are trying to do. All you need to do is split all of the IF formulas in to their own formulas.
    This will place each day in it's own column.
    Now... you'll notice that there's a lot white space and nothing's aggregated... Not to worry, it's easy to fix.
    Just create a grouping on which ever field you were going to use as "rows" in the cross tab... insert SUM totals in the group header... and hide the details.
    Now you have created your own manual cross tab, without using CR's cross tab object.
    HTH,
    Jason

  • How to generate blank cells in cross-tab (Matrix) report

    Hi All,
    I am facing issue in populating blank columns in a cross-tab report.Please help me out as it is urgent.......
    Thanks in advance.
    regards,
    sreekanth

    If you haven't found the answer yet, check out the following article. It was an immense help to me!
    http://apps2fusion.com/at/64-kr/345-matrix-cross-tab-report-bi-publisher
    HTH

  • How do I use a Cross-Tab to show me multiple fields without Summaries?

    Post Author: lindad
    CA Forum: Charts and Graphs
    Is it possible to add a Cross-Tab to a report with 6 columns and 4 rows; the values in each field are taken from a different field in the db and no summaries are used?
    Essentially the cross-tab needs to look like a table that you would create in Excel or Word.

    Post Author: Manuel de Kleine
    CA Forum: Charts and Graphs
    Linda,You cannot do that, because cross-tabs have always a summary on the axes (the number of having the value in the column AND the value in the row).If you need a table, you can use borders for your field and field header.

  • Cross Tab Report Summaries

    I have a cross tab report with a row for loan type and another row for Investor Name.  The columns are for loan disbursements by month.  The summaries are for the loan count for loan type, loan count as a % of loan type, sum of loan amount for loan type and sum of loan amount as a % of loan type.  The monthly numbers and % are correct, as well as the final column for the totals.
    The total number of loans and total sum of the loan amounts in the total row at the end of each loan type are also correct, but I want the % of loan count and % of loan amount in this row to be based on the total count of all loans on the report, not just the % of the loans in that particular loan type.
    Can someone tell me how to modify the % count summary and % sum summary just on the total row printing for the loan type?

    Hi Diann,
    Try to use the display string by right clicking on total field>format Field>Common tab-->Display string
    and write the formula like
    currentfieldvalue/count(field)
    Regards,
    Raghavendra

  • How to add an image or static text in the header of EACH page of a cross-Tab report

    Post Author: rtutus
    CA Forum: General
    Hi, I use Crustal 11.0.
    I have a cross Tab. I display the items on the left column and the months horizontally, the items are grouped by category field. The values are the sum of quantities are displayed for each month. Like this:
                             Items         Jan       Feb       March .....................Total
    Category 1                       
                             Item11         val11     Val12      Val13                     Total values
                             Item12         val21     Val22      Val23                     Total values
                             Item13         val31     Val32      Val33                     Total values
    Category 2                       
                             Item21         val11     Val12      Val13                     Total values
                             Item22         val21     Val22      Val23                     Total values
                             Item23         val31     Val32      Val33                     Total values
    Category 3                       
                             Item31         val11     Val12      Val13                     Total values
                             Item32         val21     Val22      Val23                     Total values
                             Item33         val31     Val32      Val33                     Total values
    The problem, I want to add a page header for each page of the report.
    When Crystal reports first displays my cross-tab in the designer, CR displays the cross tab in the Report header section. I d like to add text or image for each page and not only at the begining of my Cross-Tab.
    If I just add an image or text at the top of the report designer, which is my report header, I get the image or text only on the begining of the 1st page of my report but never in the other following pages.
    If I try to work around the problem and move the cross Tab to a group section instead, and then put the Image in the group header, I get what I want, but the problem is that:
    The columns header: Jan, February....December are displayed for each group of my report and not only in the beginning of the report. I get something like this:
                             Items         Jan       Feb       March .....................Total
    Category 1                       
                             Item11         val11     Val12      Val13                     Total values
                             Item12         val21     Val22      Val23                     Total values
                             Item13         val31     Val32      Val33                     Total values
                             Items         Jan       Feb       March .....................Total
    Category 2                       
                             Item21         val11     Val12      Val13                     Total values
                             Item22         val21     Val22      Val23                     Total values
                             Item23         val31     Val32      Val33                     Total values
                             Items         Jan       Feb       March .....................Total
    Category 3                       
                             Item31         val11     Val12      Val13                     Total values
                             Item32         val21     Val22      Val23                     Total values
                             Item33         val31     Val32      Val33                     Total values
    You see the months get duplicated. Any way, my real need is to add an image or text in the header of EACH page of a cross-Tab report.
    Thanks a lot for your help.

    Hi Divya,
    you could do for example in the wdDoInit() of the view
    wdContext.currentContextElement().setPicture("picture.gif");
    Now you assign this context variable to the Tab using the Tab_header's imageSource-Property. When you click on its value column, you see a button with three dots on it. If you click on this button, you will get all context nodes and attributes for this View. Usable variables are clearly marked, you now choose the one named Picture or what ever name you prefer to use. But it must correspond to the one set in the wdDoInit.
    I think setting a picture (not necessarily for the tab-page) is done in one of the excellent tutorials. If you are a newcomer I strongly recommend doing some of the tutorials.  I have learned tremendously from them.
    Hope this helped
    Harald

  • Dynamically color to each column in Cross-tab report

    Hello All,
    I am a newbie in Crystal report,from last few weeks, i am working on cross tab crystal report.i have a requirement to show color dynamically for each column.i am adding an attachment how i want it. i tried dynamic coloring using object field formula but it is showing red color to all data.i want red color data when in 2nd  cross tab report data is beyond upper or lower limit in first cross tab table. it will be very helpful if somebody will give me any clue on this.... i read so many articles now it seem like impossible for me..:(
    i am using visual studio 2010 and sap crystal report version 13.0.0.99 for visual studio 2010.

    Hello Manish,
    I have attached a sample report that does this. You will need to remove the .txt extension from the attached file to open it as an .rpt file.
    Please right click on one of the value fields of the first cross tab in the report > Format Field > Common > Suppress if Duplicated conditional formula.
    The nested formula is as follows;
    numbervar array l;
    numbervar array u;
    numbervar x:=CurrentColumnIndex;
    if GridRowColumnValue ('@limit') = 'lower limit' then
    (redim preserve l[x];
    l[x]:= tonumber(CurrentFieldValue))
    else if GridRowColumnValue ('@limit') = 'upper limit' then
    (redim preserve u[x];
    u[x]:= tonumber(CurrentFieldValue));
    false
    So it assigns each lower and upper limit value for each client (in the sample it is country) to an array using the cross tabs column index to index the array and it ends in False as we don't actually want it to suppress if duplicated. This nested formula is just used to generate the arrays of upper and lower values.
    In the second cross tab if you again right click on one of the value fields > Format Field > Font > Color you will see the following conditional formula;
    numbervar array l;
    numbervar array u;
    numbervar x;
    if not(tonumber(CurrentFieldValue) in l[CurrentColumnIndex] to u[CurrentColumnIndex]) then
    crred
    else
    crblack
    So this compaes the current field value to range generated by the 2 arrays and assigns a color based on whether or not it is in the range.
    Regards,
    Graham

  • Calculations based on Summarized data in Cross Tab

    First off, I'm pretty experienced with Crystal.
    I've run accross something that seems like it should be realy easy to do, and the sort of thing you would expect to do  in a cross tab... so maybe I'm missing something totally obvious.
    I'm doing a year over year comparison of some financial data broken down by month and by quarter.
    So, my Rows are Quarter, and a field called 'YEARMONTH' (calculated field, YYYYMM, for ease of sorting)
    My column is Year, and for summarized fields, I have the data field I'm interested in which is a float. Let's call it 'Dollars' for sake of argument.
    What I want to do is create a summary field (next to the total field) called 'Difference' or 'Delta' that calculates for reach row the difference between my two years (2008, and 2009)
    The only solution I can come up with is to dummy in a record from the datasource with a year value of 'Difference' and some other dummy values so that it will show up as a column on the cross tab, and then somehow use the currentrowcolum function or some such creature to mask the output in the column. but now that I type it out here, I'm not sure it's going to work. I also don't think it's going to export the way I want it to either.
    I'd really prefer it to be in a cross tab, and not in some manually created cross-tab emulation using manual running totals, but I'll go there if I have to.
    Thanks a ton!

    This is what I did in my report to get the difference
    my crosstab looks like this
                        2004     2005    Total
    Total              T1         T2         T
    USA               A          B          C
    INDIA              X          Y          Z
    right click on T1 and go to format field and write the suppress condition like this
    numberVar d:=0;
    currencyVar array arr1;
    currencyVar array arr2;
    numberVar e;
    if GridRowColumnValue('year')=2004 then
    (e:=e+1;
    redim preserve arr1[e];
    arr1[e]:=CurrentFieldValue)
    else
    (e:=e+1;
    redim preserve arr2[e];
    arr2[e]:=CurrentFieldValue);
    false
    right click on T and go to format field and write the Display string condition like this
    currencyVar array arr1;
    currencyVar array arr2;
    totext(arr1[1]-arr2[1])
    right click on A and go to format field and write the suppress condition like this
    currencyVar array four;
    currencyVar array five;
    numberVar d;
    if GridRowColumnValue('year')=2004 then
    (d:=d+1;
    redim preserve four[d];
    four[d]:=CurrentFieldValue)
    else
    (d:=d+1;
    redim preserve five[d];
    five[d]:=CurrentFieldValue);
    false
    right click on C and go to format field and write the Display string condition like this
    currencyVar array four;
    currencyVar array five;
    numberVar g;
    g:=g+1;
    ToText(four[g]-five[g])
    Note: Please select the option "column totals on top" for crosstab in customize style
    Hope this helps!
    Raghavendra

  • How to insert page number on each page for Cross-Tab report?

    Hi,
    I have created a Cross-Tab in the section Report Header via Crystal Reports 11.
    Now, I want to created more Cross-Tabs, and each page has one Cross-Tab.
    So, I insert Report Headers to contain Cross-Tabs. But, the report only shows the page number at the last page.
    How to insert page number on each page?
    Thanks in advance.

    Hi,
    Well, the easiest solution is to place the Cross-tab in the Report Footer, Of course, ONLY if the report contains this single object which I'm assuming is not the case.
    If you do not wish to place the cros-tab in the Report Footer, here's what you need to do:
    1) Create a formula;
    whilereadingrecords;
    2) Create a group on this formula. If the report already contains groups, move this formula to the top of the grouping list. It won't affect the other groups or records in any way.
    3) Move the Cross-tab from the Report Header to the Group Header1 and suppress Group Footer1
    4) Add the Page Number field to the Page Footer
    Let me know how this goes!
    -Abhilash

  • Sub-Summarizing columns in Cross Tab

    Post Author: valkyriexp
    CA Forum: General
    Hi,
    I'm fairly new in using CR, I wonder if anyone could help me.
    I have a cross tab report of projects in rows, activities in columns and hours in table, i need to insert  few new columns that have the sum of hours of the selected activities. Is that possible without breaking the report into sub-reports?
    some thing like
                      Act1         Act2      Sum1&2     Act3      Act4      Act5      Sum3&4&5   .....
    Proj1             1             1              2              4            2           1              7
    Proj2             2             1             3               1            0           0              1
    thanks for the help

    Post Author: valkyriexp
    CA Forum: General
    After spending half a day i was able add a new field to each column to does the job, small piece of macro is doing the summation, now i have the problem to set the width of empty fields to zero, can anyone help?
    WhileReadingRecords;global NumberVar sumnum;global StringVar OutStr;
    if {jobs.acts}="Act1" or {jobs.acts}="Act3" then     sumnum:={jobs.hour}else if {jobs.acts}="Act2" or {jobs.acts}="Act4" or {jobs.acts}="Act5" or ... then    sumnum:=sumnum+{jobs.hour}else    sumnum:=0;
    if {jobs.acts}="Act2" or {jobs.acts}="Act5" then    OutStr:=cstr(sumnum);else    OutStr:="";
    the result would be like the following table, now i need to set the width of empty fields to zero:
                      Act1         Act2             Act3      Act4      Act5        .....
    Proj1             1            1      2           4            2          1     7    
    Proj2             2            1      3           1            0          0     1    

  • How to display recordnumber for each row in cross tab?

    <p>Hi.. </p><p>I am using Crystal Report XI,with the database Microsoft SQL Server. I have 2 questions regarding Cross Tab.</p><p>1. How to limiting record per row and per column in Cross Tab? For example,at one page the report printing 20 records per row and 7 records per columns.</p><p>2. I would like to display recordnumber for each row that printing in Cross tab. How crystal reports can handle this?</p><p>Can anyone can help me out on this? </p><p>Please kindly advise.</p><p>AN </p><p> </p><p> </p>

    <p>Dear Kathryn,</p><p> </p><p>I did used DisplayString as suggested by you. The result work fine until I add more data to this cross tab. I used this formula : </p><p> global numbervar pager;</p><p>recordnumber();</p><p>pager := pager + 1; </p><p>  if pager > 0 then totext(pager - 1,0)     </p><p> </p><p>The result come out in decending order for each row. </p><p>SN    Name </p><p>5       abc<br /></p><p> 4       def</p><p>3        fig<br /></p><p>2        klm<br /></p><p>1      opq</p><p> Is that anything wrong with my formula?<br /> </p><p>Please kindly advise.</p><p>-AN- </p><p> </p><p> </p>

  • Increase Number of Decimal Points on % summarized field in Cross Tab?

    Hi,
    I have a cross tab that I have added a "% of COUNT " summarized field to, but I want to show the percentage to 2 decimal places (DP) and make the rounding more accurate. Currently the rounding means the % values do not actually total to 100%.
    I assumed this would be as simple as changing the formatting of the field to increase the 'Decimals' property to 1.00 and the rounding to 0.01.
    However when I save the changes are not reflected in my cross tab? It still shows them with 0dp? e.g. 60%
    Is it possible to get % values in a cross tab showing to 2dp? e.g. 59.82%
    Thanks

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with your directly
    Formatting is for viewing only. Using formulae to manually round the values.

  • Convert cross tab with 2 summarized fields to a chart

    Greetings,
    I have a simple cross tab containing a date row and 2 summarized fields. It looks like this (see Figure 1)
    When I convert (insert) my cross tab into a stacked bar chart, I only get one of the summarized fields to show up on the chart. It looks like this (Figure 2)
    Is there a way for me convert this cross tab into a stacked chart so that both of my summary fields appear?
    Many Thanks!

    OK... Thank you.
    I was using the cross tab  in hopes of controlling graph labels for months (Customize Group Name field) . What I was doing was converting dates to month verbiage (Sep, Oct, Nov, etc) so that the month verbiage would appear on my graphs instead of the numbers while still maintaining proper calendar order . (thanks for showing me this technique by the way as it works great). Too bad it does not work when there is more than one summary field (thanks for explaining its limitations... I had not told you that I was adding a second summary field).
    Given that I have 1 row ( Date_discharge) that I need to display as months (verbiage) in calendar order
    and
    Given that there are 2 summary fields: Vaccine Indicator (a sum) and Birth_date_Baby (a count) ...
    (I am contrasting # of vaccine's given against total babies per month in a monthly stacked bar chart)
    Is there a way to display 2 summary fields on a stacked bar graph grouped by month (where the month is listed in alpha format, (Sep, Oct, Nov, etc.) but still sorted by its calendar value? My initial attempts to do this in a graph (without a cross-tab) would display the month verbiage just fine, but it would order my months alphabetically.
    Thanks again for your suggestions!

Maybe you are looking for