How to count number of columns in cross-tab report

I have created a cross-tab report and have managed to get the data out as below:
             Jan     Feb     Mar....(display of months will auto expand) Avg/Mo  Total
UserA     4          3        4                                                                         11
UserB     6          1        1                                                                          8
UserC     5          5        5                                                                         15
Total       15        9        10                                                                        33 
I want to insert a calculated column (Avg/Mo) into the cross-tab report based on the formula: Total/Number of Months. I used this calculation formula  for Avg.Mo column:
(GridValueAt(CurrentRowIndex, CurrentColumnIndex+1, CurrentSummaryIndex)/GetNumColumns)
However, I get the wrong average since GetNumColumns count the total number of columns including the column of Avg/Mo and Total.
How do i get the number of columns, excluding the Avg/Mo calculated column and Total column?
PS: I can't use hardcode since the number of months/columns will auto expand the months progress...
Edited by: jutamind on May 26, 2010 9:27 AM

ok managed to solve this by slightly changing the formula:
GridValueAt(CurrentRowIndex, CurrentColumnIndex+1, CurrentSummaryIndex)/(GetNumColumns-2)

Similar Messages

  • How to Add new column in cross tab reports

    I am using crystal reports 10
    I created cross tab report for monthly sales. I need to add one more column in that report
    ex:
    Month   Customer    Part1  Part2    Part3      
    Jan         A               10       12         15        
    Jan         B                20      0           10        
    Jan         C               0         3           5          
    Feb        A               5         10          8          
    Feb        D               55        23        33        
    In above data Parts are no limit, thatswhy i am taking cross tab report.
    I am taking Month and Customer name as Rows,
    Part Codes as Colums,
    Quantiry as Total fields in cross tab Report.
    Here month field is storing as Transaction date in database, I am calculating by month
    I am getting upto this.
    User needs add one more field is Invoice no
    Month   Customer    Part1  Part2    Part3        Invoice no
    Jan         A               10       12         15          B1,B2,B3,B4
    Jan         B                20      0           10         B12,B30
    Jan         C               0         3           5           B6
    Feb        A               5         10          8           B35,B40
    Feb        D               55        23        33          B25,B56
    How to add invoice nos by group wise(By customer and  By month)
    Thank you.
    Raja shekar Reddy K.
    Edited by: Raja shekhar Reddy on Apr 16, 2009 5:10 PM

    Dear Amogh,
    Thanks for u'r  Replay.
    If i use new crosstab for Invoice no each invoice number can display like seperate columns.
    But I need Invoice  no in single column with seperate with "," or "/".
    Thanks & regards,
    Raja Shekar Reddy K.

  • Limiting Columns in Cross Tab reports

    Plz tell me how to limit columns in Cross Tab.I have many columns which go on and even are not visible for Scroll and neither in another page
    Plz help.

    Check if http://winrichman.blogspot.com/2009/05/cross-tab-by-limiting-number-of-colums.html is helpful

  • 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

  • How to refernce the field in the cross-tab report

    Hello,
    I'm trying to refer to the field in the cross-tab report using GridRowColumnValue function.
    The field name in formulas is DevelopmentTracking_SELECT.Completed, so I'm trying to refer like this:
    GridRowColumnValue("DevelopmentTracking_SELECT.Completed")
    I'm getting:
    "This is not the name of a grid group for the field being formatted."
    I've tried different way - gave the name of the field, for instance, or used the name form the Cross-tab expert - Max of DevelopmentTracking_SELECT.Completed, or simply use "Completed" - nothing worked.
    I see the possible cause for it. DevelopmentTracking_SELECT.Completed is not a row or column name, in the Cross-tab expert this is a Summarized field. How to reference the field like this correctly?
    Thank you,
    Peter
    Edited by: Peter Afonin on Feb 17, 2009 9:52 AM

    Oh I thought it is
    ROW: Product Name
    COLUMN:  Anticipated Date, Completed
    SUMMARIZED FIELDS: Product Stage
    Anyhow try to move the Completed field above the Anticipated Date in SUMMARIZED FIELDS by clicking up arrow.
    Now right click on the field Completed go to format field-->write the suppress condition like this
    WhilePrintingRecords;
    boolenavar i;
    i:=CurrentFieldValue;
    false
    Now right click on the Anticipated Date field and go to font and write the condition for color like this
    WhilePrintingRecords;
    boolenavar i;
    If CurrentFieldValue >= CurrentDate Then
    crGreen
    Else If CurrentFieldValue < CurrentDate And i=False Then
    crRed
    Else
    crBlack
    I hope this helps!
    Raghavendra

  • More than one summary column in cross tab reports

    Hi,
    I have a cross tab report.  The summary column is SUM. I want to add another summary column next to SUM which will be AVG(Average) column.
    Any ideas?
    Please see the attached image.
    Thanks,

    hi Anurag,
    my fault...i should have looked closer at your data.
    here's the easy way of showing two sets of summaries at the end of a crosstab, without having duplicate columns.
    1) copy your existing cross-tab and paste it to the right of your current cross-tab.
    2) now go to the cross-tab expert of the new cross-tab and remove the fields from the Column dialogue
    3) change the summary to an Average
    4) exit the cross-tab expert and go to the Section Expert for the section where both cross-tabs are...ensure that you check Relative Positions
    preview the report. now you'll have to move the 2nd cross-tab a bit so that it aligns properly with the first one.
    as a sample, see the attached report. extract the contents and change the .txt extension to .rpt.
    -jamie

  • Suppressing a prior Year Month Column on Cross Tab Report

    I have two cross tab report in the footer that compares orders booked against what was shipped by month.  I need to suppress the columns (Month) for the prior year but keep the Totals.
    I have a pdf of the report

    Try to add a formula as a column in the crosstab instead of a field. Create a formula like this
    if year()=year(currentdate)-1 then
    year()
    else
    month()
    This works only for two years of data, means you need to have the record selection formula like this
    year()>=year(currentdate)-1 and year()=year(currentdate)
    Regards,
    Raghavendra

  • How to Display Gap between Column in cross tab

    Hi,
    I have a requirement. I have a cross tab with 4 measures M1, M2, M3, M4. I need to have space between M1 and M2 and M3 and M4.
    My layout should be like this
    M1 M2 M3 M4
    Is this possible in OBIEE ?
    Thanks and Regards,
    Krishna Prasad

    krishna_36 wrote:
    Hi,
    I have a requirement. I have a cross tab with 4 measures M1, M2, M3, M4. I need to have space between M1 and M2 and M3 and M4.
    My layout should be like this
    M1 M2 M3 M4
    Is this possible in OBIEE ?
    Thanks and Regards,
    Krishna PrasadIf you want a column padding (i.e., actual blank columns that separate your measures), then create dummy columns between the measures.
    1) Click any column and in the fx enter CASE WHEN 1=0 THEN tablename.column_name END
    This will create a blank column.
    2) Put this in your pivot table, make 3 duplicate layers, and place them in between the 4 measure columns.
    In effect, you will have the spaces which you can format to highlight the buffer columns.

  • Hide Column in Cross Tab Report

    Hi guys,
    I have an issue with the Cross Tab in CR2008.
    I'm using 2 columns to calculate an other column, but these 2 columns should not be displayed in the report.
    I tried to suppress the column but it still shows a white space.
    I tried to change the column width, but it cant get it smaller then 0,113.
    Can anyone tell me how to set the column width smaller using a formula or how to suppress the whole column.
    Thanks in advance.
    William

    Hi William, 
    Instead of using all 3 columns in the crosstab, just drop your main columnn on. 
    In the Design window, not the Crosstab Experrt, right-click the summary field and select Format Field. 
    In the Common Tab, open the formula for Display String. 
    Now you can take the value of your summary using the CurrentFieldValue and make your total.  You may need to summarize the supporting numbers to calculate properly but it should work here properly. 
    I've used this for things like running totals and repeating values between rows. 
    NOTE: This formula only returns a string so make sure you format your final value as a string. 
    Good luck,
    Brian

  • Cross tab report's -one column display total counts of previous financial year, one column current financial year

    Hi
    I'm using CR XI. I'm attempting to create  a cross-tab report where:
               Added       Total
    AF         12            23
    F            15           30
    CO         18           50
    Where AF etc is the categoty of items, Added is the total count of previous finanical year(e.g. 1 July 2006 to 30 June 2007), Total is the total account of current finanical year.
    The count is based on created_date field(e.g. ITD.DTE -- ITD is the table, DTE is the field).
    Although I can at the moment only display the value correctly in "Added"  column, if I tried to display the Total column, the two columns always have the same value.
    How could I achieve the above desired results by using fomula? I would appreciate it very much if anyone could help me with this?
    Thanks in advance
    JS

    Create 2 formulas, 1 for the previous year and 1 for current, similar to the following;
    1) if date({Orders.Order Date}) in date(2003,07,01) to date(2004,06,30) then 1 else 0
    2) if date({Orders.Order Date}) in date(2004,07,01) to date(2005,06,30) then 1 else 0
    Add both of these formulas as the summarized fields in the crosstab

  • How to count number of sales orders generated in a month in SAP SD

    Hi SD Gurus,
    I have a very strange query from client. I have to count the number of sales order created in a month for a z report. For example 30 in Jan, 25 in Feb etc. Could anyone suggest me How to count number of sales orders generated in a month in SAP SD.
    Regards
    Vinod Kumar

    Hi,
    Goto the T.Code "SE16" or "SE16n" or "SE11".
    Enter the table name as VBAK
    Enter the created on date as the starting date of the period and to date as the end date.
    Enter.
    Click on "Number of Entries".It will tell you the number of entries created in a particular period.
    If you want a report,goto the T.Code "VA05n".
    Regards,
    Krishna.

  • How to Count Number of completed line items in past 6 months / 12 months ?

    How to Count Number of completed line items in past 6 months / 12 months ?
    Hi,
    I am trying to count "Number of Completed Line Items in Purchase Order Document" for my Key Figure ZPO_CNT.
    Purchase Order document = ZEBELN
    Line Item = ZEBELP.
    I need to find and count if the Line Item has been received in the past 6 months from today and similarly in the past 12 months.
    I have "Delivery Completed" field, ELIKZ.
    So, based on this would I be able to calculate it in Query Designer?
    If so, Please let me know how

    Hello Deva
    If youe want to calculate the completed line item for last 6 or 12 month then i think u will be displaying the query data for these montrhs...create a customer exit to give you date range and restric it in filter area....
    Now Choose any of the below option
    1. I would suggest to implement an additional key figure "counter" in cube and fill values with one for which delivery is completed.
    Now use calculated key figure in Query Designer based on logic
    IF counter = 1 THEN counter ELSE 0
    OR
    2. create a formula variable based on ELIKZ and use replacement path variable, it will display you no. of docs for which delivery is completed....
    Award points if it solves your problem
    Revert back in case of further assistance...
    Thanks
    Tripple k

  • How to count number of ones in table

    Hello,
     i created one table 16x32 each cell is updating 1 byte of data,how to count number of one in all cell,and is it right way to calculate check sum??
    thank you

    The simplest way is to call GetTableCellRangeValues with VAL_ENTIRE_TABLE as the range, next summing array elements.
    But I don't understand your comment on checksum, so this may not be the more correct method for your actual needs: can you explain what do you mean?
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to incrase number of columns in layout

    hi all,
    i am new to business intelligence my problem is
    how to insert number of columns in report layout
    i am not able to more than 5 or 6 columns then
    a pop-up is appearing as "cannot insert column because there not enough space"
    plz give solution
    thanks

    To get IColumnPrefs assuming you have an IDocument I use
    InterfacePtr<IColumnPrefs> colPrefs(document->GetDocWorkSpace(), UseDefaultIID());
    int32 columnCount = colPrefs->GetNumColumns();
    Mike

  • How to count number of rows in table

    can I get number of row in table except Count(*) in pl/sql
    is there any other way

    Also posted and answered here
    how to count number of rows in table
    count(*) will be the fastest way. It is only slow if the table has a vast number of rows, in which case why do you need to know the tables has 73552436467721 rows and not 73552436467737 rows. It doesn't seem to be much use. Either that or you are counting them a lot, which again seems rather pointless.

Maybe you are looking for

  • How to split the screen in to 9 different peice ?!?!?!?

    Hi everyone ! I want to create a video as a gift for my girl as her 20th birthday is coming soon! The video I want to create is look like a cubic, with my face all around the centre and looking to her ( a video of her will be in the centre) and 8 dif

  • Bluetooth not on a mobile device

    Hi there! I am trying to get started with Bluetooth ... I made it so far, that I compiled and used a Demo (ImageServer and ImageClient, if someone knows) ... Now I made a new Project, not an J2ME-Project, and try to get Bluetooth running on my Notebo

  • Email Reports

    I have a scheduled job that generates a report in csv format. Is there any way i can mail this report to certain ids?

  • Too many tables

    iam developing h.r web application that use ejb technology, and the database of my application about 73 tables and about 65% of these tables is lookup tables do i have to map all the tables to entity beans? i think this will kill the performance?????

  • What are the best wireless chat headphones for walking with my iphone, i dont like earbuds

    i need something comfortable i was looking at the sennheise mm 100. any suggestions. thanks