Counting rows and group by

Hi
in query below
WITH AUX_CONSULTORA AS (SELECT T2.CD_CONSULTORA,
                                     T2.CD_TIPO_ESTRUTURA_COMERCIAL,
                                     T2.CD_ESTRUTURA_COMERCIAL,
                                     T2.NM_CICLO_INICIO,
                                     T2.DC_NOME_CONSULTORA
                                FROM T_CONSULTORA_INDICADA T1,
                                     T_CONSULTORA          T2
                               WHERE T1.CD_CONSULTORA_INDICADA =
                                     T2.CD_CONSULTORA
                                 AND T1.CD_CONSULTORA_INDICANTE =
                                    4701040 --- CONSULTORA INDICANTE
                                 AND T2.NM_CICLO_INICIO <=
                                    200802 --- CICLO ATUAL
                                 AND T2.NM_CICLO_INICIO >=
                                     200716 --- TRES CICLOS ANTERIORES
                              )SELECT                                                       
                             DC_NOME_CONSULTORA,
                              W1.CD_CONSULTORA,
                           NM_CICLO_INICIO,
                           W2.NM_CICLO_OPERACIONAL,
                           w2.vl_indicador
                     FROM AUX_CONSULTORA           W1,
                           T_EC_PESSOA_PERFIL_CICLO W2
                    WHERE W1.CD_TIPO_ESTRUTURA_COMERCIAL =
                          W2.CD_TIPO_ESTRUTURA_COMERCIAL
                      AND W1.CD_ESTRUTURA_COMERCIAL =
                          W2.CD_ESTRUTURA_COMERCIAL
                      AND W2.CD_CONSULTORA = W1.CD_CONSULTORA
                      AND W2.CD_PERFIL = 1
                      AND W2.CD_INDICADOR = 2
                      AND W2.NM_CICLO_OPERACIONAL <=  200802
                      AND W2.NM_CICLO_OPERACIONAL >=  200716
                      AND W2.NM_CICLO_OPERACIONAL >=  W1.NM_CICLO_INICIO
                      AND W1.NM_CICLO_INICIO >200716
                    ORDER BY W1.DC_NOME_CONSULTORA ASC;
DC_NOME_CONSULTORA                       CD_CONSULTORA NM_CICLO_INICIO NM_CICLO_OPERACIONAL      VL_INDICADOR
CRISTIANE MARIA MARQUES SUCUPIRA              38178923          200802               200802              0.00
ELIONITA DE MATOS COSTA                       39218910          200801               200801              0.00
ELIONITA DE MATOS COSTA                       39218910          200801               200802              1.00
IBRANDINA LOPO MONTALVAO                      38176661          200717               200717              0.00
IBRANDINA LOPO MONTALVAO                      38176661          200717               200801              0.00
IBRANDINA LOPO MONTALVAO                      38176661          200717               200802              0.00
JANAINA NOBRE DE MENEZES JORDAO RAMOS         38072777          200801               200801              0.00
JANAINA NOBRE DE MENEZES JORDAO RAMOS         38072777          200801               200802              0.00
JOCINELIA DE SOUZA LEITE                      38518490          200717               200802              0.00
JOCINELIA DE SOUZA LEITE                      38518490          200717               200801              1.00
JOCINELIA DE SOUZA LEITE                      38518490          200717               200717              0.00
WALLACE DE OLIVEIRA XIMENES                   41824407          200717               200717              0.00
WALLACE DE OLIVEIRA XIMENES                   41824407          200717               200801              1.00
WALLACE DE OLIVEIRA XIMENES                   41824407          200717               200802              2.00
I must to count distinct CD_CONSULTORA , in example above there are 6
I did SELECT COUNT(DISTINCT) work fine , but now I must to Count WHEN
W1.NM_CICLO_INICIO = 200716 and W2.NM_CICLO_OPERACIONAL = 200717 and in this cycle (200717) w2.vl_indicador =0 or W2.NM_CICLO_OPERACIONAL = 200801 and w2.vl_indicador =0
Some know how can to do it ?
see result for W1.NM_CICLO_INICIO =200716
WITH AUX_CONSULTORA AS (SELECT T2.CD_CONSULTORA,
                                     T2.CD_TIPO_ESTRUTURA_COMERCIAL,
                                     T2.CD_ESTRUTURA_COMERCIAL,
                                     T2.NM_CICLO_INICIO,
                                     T2.DC_NOME_CONSULTORA
                                FROM T_CONSULTORA_INDICADA T1,
                                     T_CONSULTORA          T2
                               WHERE T1.CD_CONSULTORA_INDICADA =
                                     T2.CD_CONSULTORA
                                 AND T1.CD_CONSULTORA_INDICANTE =
                                    4701040 --- CONSULTORA INDICANTE
                                 AND T2.NM_CICLO_INICIO <=
                                    200802 --- CICLO ATUAL
                                 AND T2.NM_CICLO_INICIO >=
                                     200716 --- TRES CICLOS ANTERIORES
                              )SELECT                                                       
                             DC_NOME_CONSULTORA,
                              W1.CD_CONSULTORA,
                           NM_CICLO_INICIO,
                           W2.NM_CICLO_OPERACIONAL,
                           w2.vl_indicador
                     FROM AUX_CONSULTORA           W1,
                           T_EC_PESSOA_PERFIL_CICLO W2
                    WHERE W1.CD_TIPO_ESTRUTURA_COMERCIAL =
                          W2.CD_TIPO_ESTRUTURA_COMERCIAL
                      AND W1.CD_ESTRUTURA_COMERCIAL =
                          W2.CD_ESTRUTURA_COMERCIAL
                      AND W2.CD_CONSULTORA = W1.CD_CONSULTORA
                      AND W2.CD_PERFIL = 1
                      AND W2.CD_INDICADOR = 2
                      AND W2.NM_CICLO_OPERACIONAL <=  200802
                      AND W2.NM_CICLO_OPERACIONAL >=  200716
                      AND W2.NM_CICLO_OPERACIONAL >=  W1.NM_CICLO_INICIO
                      AND W1.NM_CICLO_INICIO =200716
                    ORDER BY W1.DC_NOME_CONSULTORA ASC;
DC_NOME_CONSULTORA                       CD_CONSULTORA NM_CICLO_INICIO NM_CICLO_OPERACIONAL      VL_INDICADOR
ANA GLORIA DIAS DE CARVALHO                   43048927          200716               200802              2.00
ANA GLORIA DIAS DE CARVALHO                   43048927          200716               200801              1.00
ANA GLORIA DIAS DE CARVALHO                   43048927          200716               200717              0.00
ANA GLORIA DIAS DE CARVALHO                   43048927          200716               200716              0.00
ELAINE MARIA DE SANT ANNA                     43985238          200716               200717              1.00
ELAINE MARIA DE SANT ANNA                     43985238          200716               200801              2.00
ELAINE MARIA DE SANT ANNA                     43985238          200716               200802              3.00
ELAINE MARIA DE SANT ANNA                     43985238          200716               200716              0.00
EURIDES DE BARROS SANTOS                      38146681          200716               200802              0.00
EURIDES DE BARROS SANTOS                      38146681          200716               200801              0.00
EURIDES DE BARROS SANTOS                      38146681          200716               200716              0.00
EURIDES DE BARROS SANTOS                      38146681          200716               200717              0.00
JOSEFA DA SILVA RIBEIRO DE AVILA              34589813          200716               200801              0.00
JOSEFA DA SILVA RIBEIRO DE AVILA              34589813          200716               200717              1.00
JOSEFA DA SILVA RIBEIRO DE AVILA              34589813          200716               200716              0.00
JOSEFA DA SILVA RIBEIRO DE AVILA              34589813          200716               200802              1.00
KARLA RESENDE MARANHAO                        42536502          200716               200801              0.00
KARLA RESENDE MARANHAO                        42536502          200716               200802              0.00
KARLA RESENDE MARANHAO                        42536502          200716               200717              1.00
KARLA RESENDE MARANHAO                        42536502          200716               200716              0.00
DC_NOME_CONSULTORA                       CD_CONSULTORA NM_CICLO_INICIO NM_CICLO_OPERACIONAL      VL_INDICADOR
MARISTELA MATIAS DE ALIXANDRIA                 4488954          200716               200716              0.00
MARISTELA MATIAS DE ALIXANDRIA                 4488954          200716               200717              1.00
MARISTELA MATIAS DE ALIXANDRIA                 4488954          200716               200801              2.00
MARISTELA MATIAS DE ALIXANDRIA                 4488954          200716               200802              0.00
24 rows selectedthanks
Message was edited by:
muttleychess

If I treat your question right (not sure) you want to have separate counts for some specific conditions within one group.
Maybe CASE is that you need:
SQL> select deptno, job from emp order by 1,2;
    DEPTNO JOB
        10 CLERK
        10 MANAGER
        10 PRESIDENT
        20 ANALYST
        20 ANALYST
        20 CLERK
        20 CLERK
        20 MANAGER
        30 CLERK
        30 MANAGER
        30 SALESMAN
        30 SALESMAN
        30 SALESMAN
        30 SALESMAN
14 rows selected.
SQL> select deptno, count(case job when 'CLERK' then 1 end) "clerks",
  2  count(case job when 'SALESMAN' then 1 end) "sales"
  3  from emp
  4  group by deptno;
    DEPTNO     clerks      sales
        30          1          4
        20          2          0
        10          1          0Rgds.

Similar Messages

  • Compare two cells in a row and group of rows

    Tuesdays 1st 2nd 3rd 4th 5th MB
    Jan 4, 2011 7 14 21 28 36 32
    Jan 11, 2011 5 15 25 28 38 16
    Jan 18, 2011 2 17 25 28 38 25
    Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
    I thought an IF formula might do it, but can't figure it out.
    Thanks in advance!
    Jim

    Head Crab wrote:
    Tuesdays 1st 2nd 3rd 4th 5th MB
    Jan 4, 2011 7 14 21 28 36 32
    Jan 11, 2011 5 15 25 28 38 16
    Jan 18, 2011 2 17 25 28 38 25
    Okay, say the above is my table, how do I compare two cells in a row for two numbers? Say I wanted to find out if row A2 contained a 7 and a 28?
    "A2" is an address for a single cell, not a row. Its current content, assuming no empty rows above or empty columns left of what's shown, is "Jan 4, 2011". Perhaps you mean Row 2, or the range B2:G2.
    Assuming that you want to know 'if' (or 'how many times') two specific numbers occur in the range of cells from column B to column G in a single row, COUNTIF is the function you want.
    Place the two target numbers into cell I1 and J1.
    Enter the formula below into I2:
    =COUNTIF($B2:$G2,I$1)
    Fill the formula right into J2, then fill both down to row 4.
    You'll get a count of the occurrences of each number.
    If you want only a "Yes" (both numbers appear in the range) or "No" (neither of the numbers appear, or one appears but not the other), use this variation (in I2 or J2):
    =IF(AND(COUNTIF($B2:$G2,I$1)>0,COUNTIF($B2:$G2,J$1)>0),"Yes","No")
    Regards,
    Barry

  • Error in query with COUNT expression and Group By Clause

    Hi
    I have this query that when run gives me the following error:
    SQL command not properly ended:
    The code is as below:
    SELECT
              st_enrollment.student_id ,
              ce_family_member.last_name ,
              st_enrollment.grade_level ,
              ce_family_member.DATE_OF_BIRTH ,
              ce_family_member.GENDER,
              at_hourly_attendance_records.ABSENCE_REASON_CODE,
              at_hourly_attendance_records.CALENDAR_DATE,
              COUNT(st_enrollment.student_id) AS days_absent
              FROM
                      at_hourly_attendance_records,
                      ce_family_member,
                      st_enrollment
              WHERE
              st_enrollment.student_id = at_hourly_attendance_records.student_id
             AND ce_family_member.student_id = st_enrollment.student_id
                AND st_enrollment.school_id = 705
                AND st_enrollment.school_year = 2006
                AND st_enrollment.district_number = 1000
                AND at_hourly_attendance_records.ATTENDANCE_STATUS = 'A'
                AND at_hourly_attendance_records.CALENDAR_DATE < '16-MAR-06'
              GROUP BY st_enrollment.student_id,
                       ce_family_member.last_name
                         st_enrollment.grade_level ,
                         ce_family_member.DATE_OF_BIRTH ,
                         ce_family_member.GENDER,
                         at_hourly_attendance_records.ABSENCE_REASON_CODE,
                         at_hourly_attendance_records.CALENDAR_DATE;
           All suggestions are gratefully acknowledgment, Thanks in advance

    Thanks a lot. In fact I discovered it myself and I am immensely grateful to you for pointing the error..

  • Stored procedure to count rows and columns- NEWB

    I have  the following table and I want to get a count of 'Enabled' in each column and output to a new table with the same column names with counts. Is this possible?
    AzureRMS    Office_PP   Lync        Office_Onli Sharepoint  Exchange    Visio       Project     ExchangeArc
    Disabled    Enabled     Disabled    Enabled     Enabled     Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Enabled     Enabled     Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Enabled     Enabled     Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Enabled     Enabled     Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Enabled     Enabled     Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Disabled    Enabled     Disabled    Disabled    Disabled    Disabled    Disabled    Disabled    Disabled
    Dan

    Hello Dan,
    The base query is a conditional sum, like:
    SELECT
    SUM(CASE WHEN AzureRMS = 'Enabled' THEN 1 ELSE 0 END) AS CountAzureRMS
    ,SUM(CASE WHEN Office_PP = 'Enabled' THEN 1 ELSE 0 END) AS CountOffice_PP
    , -- and so on
    FROM yourTable
    just complete it for the other columns.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]
    Thanks!  
    How do I write this a stored procedure using a tablename as a parameter?
    Dan
    Thats not recommended. Why do you want write a generic procedure for this passing tablename as a parameter??
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    I am accessing the data via powershell/windows forms and I like to simplify the query.
    Dan

  • Read file and count rows and columns

    Can someone guide me on how can I accomplish the following
    a) read what supposedly is a matrix from text file
    b) make sure all the entries in input are integers
    c) if not raise error, else
    c) is the matrix a square matrix?
    d) if not raise error if its not square matrix else
    e) if it's a square matrix, print the matrix on the screen
    please give me pointers.. some code snippet is ok. but would like to code to some degree myself. so i can grasp how java works.
    thanks

    javadonkey wrote:
    how do I verify if all the lines consist of ints. Well, there are two parts here. One is to split the line into tokens, and the other is to try to parse each of those tokens as an int. There are two ways you could do this:
    1) String.split() and Integer.parseInt(). See the javadocs for details of those methods.
    2) Use java.util.Scanner. Again, see its javadocs, and you may also want to look at a java io tutorial, like this one: [http://java.sun.com/docs/books/tutorial/essential/io/]
    and if its a square matrixCan you define in English what makes a square matrix?

  • Column displays going down. Need it to go across and group together.

    I have an Oracle report I've created and I'm trying to get certain columns of data to display only for the first row and grouped together going horizontally. It's hard for me to explain in words what I need to be done. I could email some screen shots explaining if someone is willing to help me. Thanks in advance!

    What about using the report functionality itself?
    Create the report as Group Left vendor wise and for the Repeating Frams of field Class_Code set the Print Direction to Across/Down and the Horizontal Elasticity to Variable and for all the Parent Frames same. Then it should work as expected.
    Or keep the report tabular and use the formula column as below...
    DECLARE
      CURSOR Fetch_Codes IS
      SELECT class_code
      FROM table_name
      WHERE vendor = :vendor;
      vClsCodes table_name.class_code%TYPE;
    BEGIN
      FOR Get_Codes IN Fetch_codes LOOP
       vClsCodes:=vClsCodes||Get_Codes.class_code||', ';
      END LOOP;
      RETURN vClsCodes;
    END;In the layout editor use this formula column as source of class codes.
    -Ammad

  • Advanced datagrid with grouped columns and grouped rows

    hello every body, plz need your experience help. 'cause Im so new using FLEX
    I have an XML (like an XML data type) something like this
    <Table>
      <Rows>
        <cAgencia>F0002</cAgencia>
        <cAgNombre>SanBorja</cAgNombre>
        <cTVentanilla>V0002</cTVentanilla>
        <dTVNombre>Plataforma</dTVNombre>
        <TcksEnEspera>20</TcksEnEspera>
        <VentsEnAtencion>50</VentsEnAtencion>
      </Rows>
      <Rows>
         <cAgencia>F0003</cAgencia>
         <cAgNombre>Miraflores</cAgNombre>
         <cTVentanilla>V0002</cTVentanilla>
         <dTVNombre>Plataforma</dTVNombre>
         <TcksEnEspera>30</TcksEnEspera>
         <VentsEnAtencion>40</VentsEnAtencion>
       </Rows>
      <Rows>
         <cAgencia>F0002</cAgencia>
         <cAgNombre>SanBorja</cAgNombre>
         <cTVentanilla>V0003</cTVentanilla>
         <dTVNombre>Caja</dTVNombre>
         <TcksEnEspera>55</TcksEnEspera>
         <VentsEnAtencion>25</VentsEnAtencion>
       </Rows>
       ...... (continue)
    </Table>
    so, I need to make a table (I guess with advancedDataGrid) something like this
    as you can see,   I have to group them by columns and Rows.  I have found a "mx:groupedColumns" that maybe could help me , but I couldn't find something like "mx:groupedRows".
    The grid may be dynamic,   for example if I have another XML node like:
      <Rows>
         <cAgencia>F0004</cAgencia>
         <cAgNombre>SanMiguel</cAgNombre>
         <cTVentanilla>V0002</cTVentanilla>
         <dTVNombre>Plataforma</dTVNombre>
         <TcksEnEspera>15</TcksEnEspera>
         <VentsEnAtencion>52</VentsEnAtencion>
       </Rows>
    the grid may add a ROW and in the column of plataforma add the data: 15 and 52, so the grid may be something like this:
    as you can see, the grid may add rows and columns in depends of the count of XML data.
    plz help.
    thanks, regards  from Lima, Peru.
    JS

    any help ????????? I found OLAPDataGrid .....   I was thinking to send all the data into a bidimensional Array , then pass the data of my bidimensionalArray to  OLAPDataGrid ...  but I'n not sure if Flex is able to do it  .... 
    the really serious problem is the special ROW I must use ...
    regards
    JS

  • How to count rows in a group =Count(Fields!FirstName.Value,"GroupByInitial")

    I have a tablix grouped on column a and detailed on column b.
    I am trying to count the rows in 3 separate ways.
    CountDistinct(Fields!A.Value) =work perfectly on group column
    CountDistinct(Fields!B.Value) = work perfectly on the detail column
    But now I was
    Count(Fields!A.Value) = on the group column but I get all the detailed count 13  instead of just the group count of 4.

    Hi Giss68,
    Based on my understanding, you want to calculate the count of the group fields, right?
    In your scenario, if you use Count(Fields!A.Value), the expression returns a count of specified values evaluated in the dataset scope. So it’s expected that you get count of all Fields!A.Value instead of grouped fields. Since you want to calculate the count
    of grouped column fields, you should use CountDistinct() function.
    As we tested in our environment, we specify the expression with CountDistinct() function, we can get expected result.
    Reference:
    Count Function (Report Builder and SSRS)
    CountDistinct Function (Report Builder and SSRS) 
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Count() for each group, but only groups having 1+ element like... AND all elements like...

    There are tables(and columns) like:
    'Clients'(clientID)
    'Houses' (houseID)
    'Visits' (clientID, houseID, visit_date)
    'Contracts'(contractID, houseID, clientID, rentDate_from, rentDate_end)
    I have problem with writing MS SQL query of this kind:
    how many visits to houses did each client, before renting one of them?
    Its easy to count total number of Visits for each client, listing all visits + group by clientID and selecting count(*) for each group.
    Lets say this is select_1, and select_2 is listing all Contracts for all clients.
    Select_1 is not answer, because count must be performed only on groups, which:
    -have at least 1 row "like" row in select_2 (it means that at least one of visited houses was rented, because it can happen that client visited few houses, but rented other, not visited house). my idea for this is comparing select_1 and select_2 with:
    "where s1.clientID=s2.clientID and s1.houseID=s2.houseID"
    -each group must have all rows(visits) with date of same day or earlier than contract date
     maybe: "datediff(day, s1.visit_date, s2.rentDate_from) >= 0"

    In future, please provide proper DML, DDL and example data, like I have for you below.
    DECLARE @clients TABLE (clientID INT, name VARCHAR(20))
    INSERT INTO @clients (clientID, name)
    VALUES (1, 'Jonathan'),(2, 'Christopher'),(3, 'James'),(4, 'Jean-Luc'),(5, 'William')
    DECLARE @houses TABLE (houseID INT, address VARCHAR(20))
    INSERT INTO @houses (houseID, address)
    VALUES (1, 'NX01'),(2, 'NCC 1701'),(3, 'NCC 1071A'),(4, 'NCC 1701D'),(5, 'NCC 1701E')
    DECLARE @visits TABLE (clientID INT, houseID INT, visitDateTime DATETIME)
    INSERT INTO @visits (clientID, houseID, visitDateTime)
    VALUES (1,1,'2001-01-01 12:13:14'),
    (2,2,'2001-01-02 12:13:14'),
    (3,2,'2001-01-01 12:13:14'),(3,3,'2001-01-01 12:13:14'),
    (4,4,'2001-01-01 12:13:14'),(4,5,'2001-01-01 12:13:14'),
    (5,4,'2001-01-01 12:13:14'),(5,5,'2001-01-01 12:13:14')
    DECLARE @contracts TABLE (contractID INT IDENTITY, houseID INT, clientID INT, rentStartDate date, rentEndDate date)
    INSERT INTO @contracts (houseID, clientID, rentStartDate, rentEndDate)
    VALUES (1,1,'2001-01-02',NULL),(2,2,'2001-01-02',NULL),(3,3,'2001-01-02',NULL),(4,4,'2001-01-02',NULL),(5,5,'2001-01-02',NULL)
    SELECT contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address, COUNT(v.clientID) AS visits
    FROM @contracts c
    LEFT OUTER JOIN @clients cl
    ON c.clientID = cl.clientID
    LEFT OUTER JOIN @houses h
    ON c.houseID = h.houseID
    LEFT OUTER JOIN @visits v
    ON c.clientID = v.clientID
    AND c.rentStartDate >= v.visitDateTime
    GROUP BY contractID, c.houseID, c.clientID, rentStartDate, rentEndDate, cl.clientID, name, h.houseID, address

  • Rows count for repetitive groups in tablix.

    Hi All,
    To make the story cut short, i will going to explain my scenario:
    i have a tablis contro and i garoup it by a field say "Field1" which contains A and B values,
    in my case we divide groups in two parts if it has rows more then 200.
    so, my report output and my required is below :
    Current Output -------------------------- Required layout
    here 200, 20, 30 are number of rows per group.
    now my requirement is if a group is repetitive
    i need the all rows count for that value like in above case :
    Header text of  Group A should be like : A(220) i.e 200 +20
    please help me on this...
    it is very urgent for me
    shashank

    hi Simon,
    thanks for reply, sorry, i skipped to mentioned that i have to provide multilevel grouping also, like 
    Group By: Field 1 -> Field 2 -> field3
    so, to achieve my requirement by Sql as solution has no problem if i do not have multilevel grouping, but i have to provide that and in that case the query will be like,
    “select distinct [column1],[Column2],[Column3],count(*) as rn from [table] group by [column1],[Column2],[Column3]”
    which is problematic in my case.
    so for doing this i need a solution apart from sql but by using SSRS Report end.
    Thanks again.
    Shashank

  • Using member sorting and grouping with two reports sharing rows

    Hi!
    I have a problem with one report and I need some help or advise here.
    I have two dimensions with dynamic expansion in rows (PRODUCT, MATERIAL), and I use the option Member Sorting and Grouping at Member selector to obtain the total amount of PRODUCT group by PARENTH1:
    PRODUCT               MATERIAL          AMOUNT
    TOTAL PROD_A-X                                   100
    PROD_A_A             MAT1                          22
    PROD_A_B             MAT1                          50
    PROD_A_A             MAT2                          28 
    TOTAL PROD_B-X                                   120
    PROD_B_A             MAT1                          30
    PROD_B_A             MAT2                          50
    PROD_B_B             MAT2                          40
    This works fine if I only have one report, but I need to create another one sharing the row and page axis with the Default Report, when I do that the option Member Sorting and Grouping doesn't work. I really need to have two reports with shared rows and also the summation by PARENTH1, how can I do that?
    Thank you very much

    Hi!
    I have a problem with one report and I need some help or advise here.
    I have two dimensions with dynamic expansion in rows (PRODUCT, MATERIAL), and I use the option Member Sorting and Grouping at Member selector to obtain the total amount of PRODUCT group by PARENTH1:
    PRODUCT               MATERIAL          AMOUNT
    TOTAL PROD_A-X                                   100
    PROD_A_A             MAT1                          22
    PROD_A_B             MAT1                          50
    PROD_A_A             MAT2                          28 
    TOTAL PROD_B-X                                   120
    PROD_B_A             MAT1                          30
    PROD_B_A             MAT2                          50
    PROD_B_B             MAT2                          40
    This works fine if I only have one report, but I need to create another one sharing the row and page axis with the Default Report, when I do that the option Member Sorting and Grouping doesn't work. I really need to have two reports with shared rows and also the summation by PARENTH1, how can I do that?
    Thank you very much

  • Need help to count number of rows and display in file

    Hello,
    my scenario is IDOC to File......i am using XSLT mapping and using FCC parameters to convert the flat file.
    now new requirement is i need to count number of rows and add count value last of the file.
    Please let me know how to do it,
    thanks in advance for your help.
    Regards,
    Chinna

    thanks again, one more Q.
    in XSLT mapping i have written for loop for complete structure.
    example : <Details>
                         <node1>
                         <node2>
                   </details>
    in XSLT mapping
                         <xsl:for-each select="ZMATMAS_01/IDOC/E1MARAM">
         <Details>
         </Details>
         </xsl:for-each>
    if i add the field at target side....then i will come under details node and it will be repeated.
    how to declare in XSLT mapping.

  • Group and Group counter in Routing

    Hi all,
    what is group and group counter in routing , how these are used in routing , please explain.
    Regards,
    Joseph.

    Dear Joseph,
    1.Each routing is stored against a group and group counter no.
    2.When we create routing without respect to any material and only by giving the plant,the set of operations gets saved under one
    group counter and group no.
    4.Many materials can be assigned to this same group and group counter no,so that the routing is valid for all the materials included.
    5.When you create a routing for material specific,the set of operation gets saved in a group no and group counter no as 01,when
    you create another routing with another set of operations for the same material,plant and task list combination now the group no
    remains same and the group counter gets saved under 02.
    6.This data can be further helpful in assigning the routing data in the production version,.
    Check and revert
    Regards
    S Mangalraj

  • How do I know which group and group counter used to create current estimate

    Is there a way to know, if for a given set of materials, what groups and groups counters have been used to create the current cost estimate. Or for a given comboniation of material, group and group counter has been used to create a current cost estimate. I can look each up through displaying the cost estimate but I am looking for a quick way since the number of materials are in 100s.
    I was wondering if there is a table I could look up to get the info.
    Any help would be much appreciated.
    Regards

    The name of the table that needs to be used is KEKO. I figured it out so I thought I would share
    Edited by: NIK83 on Mar 7, 2011 10:16 PM

  • CR - giving total transaction count for few groups and 0 for few groups.

    For the column "No of First Call Resolution" I have to count no of interactions based on the Interaction Result, the formula is
    COUNT(Interaction_ID) WHERE INTERACTION_RESULT = 'FCR'
    For which, I wrote the below formula
    If {14CICustomerInteractions_query.Interaction Result} = "FCR" then Count ({14CICustomerInteractions_query.Interaction_ID})
    I have 33,232 interactions on the particular day I selected. When I try to group up and do the calculations it is giving total transaction count for few groups and 0 for few groups.
    Need Solution

    Hi,
    What field is the report grouped on?
    If you wish to find the no of interactions based on some condition and display it for every group, then here's what you need to do:
    1) Create this formula and place this on the details section:
    whileprintingrecords;
    numbervar c;
    If {14CICustomerInteractions_query.Interaction Result} = "FCR" then
    c := c + 1;
    2) Create another formula and place this one on the Group Footer:
    whileprintingrecords;
    numbervar c;
    3) Create this formula to reset the variable and place this on the Group Header:
    whileprintingrecords;
    numbervar c := 0;
    Let me know how this goes!
    -Abhilash

Maybe you are looking for