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

Similar Messages

  • 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

  • There was an error while updating row count for "SH".."SH".CHANNELS

    Hi All,
    Am new to OBIEE.Pls help in this regard.
    Am building the physical layer as per Repository guide.When am importing the data in to this,am getting the below error.
    *"There was an error while updating row count for "SH".."SH".CHANNELS" :"*
    channles is the table name and having 5 rows.
    but am able to see the data in the sql prompt. like SELECT * FROM SH.CHANNELS then 5 rows data would be displaying..
    pls help in this regard and where is the excat problem?
    Thanks,

    what is the error?
    Make sure that your connection pool settings are okay..
    Make sure that, you are using correct driver in case of if you are using ODBC dsn..
    Also make sure that, your oracle server is running... TNS and Oracle server services

  • How to get row count(*) for each table that matches a pattern

    I have the following query that returns all tables that match a pattern (tablename_ and then 4 digits). I also want to return the row counts for these tables.
    Currently a single column is returned: tablename. I want to add the column RowCount.
    DECLARE @SQLCommand nvarchar(4000)
    DECLARE @TableName varchar(128)
    SET @TableName = 'ods_TTstat_master' --<<<<<< change this to a table name
    SET @SQLCommand = 'SELECT [name] as zhistTables FROM dbo.sysobjects WHERE name like ''%' + @TableName + '%'' and objectproperty(id,N''IsUserTable'')=1 ORDER BY name DESC'
    EXEC sp_executesql @SQLCommand

    The like operator requires a string operand.
    http://msdn.microsoft.com/en-us/library/ms179859.aspx
    Example:
    DECLARE @Like varchar(50) = '%frame%';
    SELECT * FROM Production.Product WHERE Name like @Like;
    -- (79 row(s) affected)
    For variable use, apply dynamic SQL:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Rows count all tables:
    http://www.sqlusa.com/bestpractices2005/alltablesrowcount/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Get row count for different tables to the same line

    How can I get the row count for different tables in one line:
    SELECT count(A), count(B), count(C) from table tb_a A , tb_b B, tb_c C;
    Thanks!

    >
    Hi,
    How can I get the row count for different tables in one line:
    SELECT count(A), count(B), count(C) from table tb_a A , tb_b B, tb_c C;Something like this? One of the many uses for CTE's - Common Table Expressions - AKA
    subquery refactoring. Worth getting to know - very handy!
    with acount as
      select count(*) as counta from dual  -- put your table name here
    bcount as
      select count(*) as countb from dual  -- put your table name here
    ccount as
      select count(*) as countc from dual  -- put your table name here
    select a.counta, b.countb, c.countc from acount a, bcount b, ccount c;HTH,
    Paul...
    Edited by: Paulie on 25-Jul-2012 17:44

  • Problem w/: Error while getting estimated row count for view

    JDev 10.1.3 - Steps
    1. created a ADF VO w/ one bind variable vNAME.
    2. Created a basic jspx page, use the data control pal. to drop in VO w/ executeparam option. Use the data control pal to drop in VO w/ ADF Read-Only Table w/ select and sort option. Selected all VO columns in table.
    3. Following Error msg occurs when running jspx page -
    oracle.jbo.DMLException: Error while getting estimated row count for view object CategoryView, statement SELECT count(1) FROM (SELECT
    CATEGORY.CATID CATID,
    CATEGORY.NAME NAME,
    CATEGORY.PICTURE PICTURE,
    CATEGORY.ACTIVE ACTIVE
    FROM
    CATEGORY
    WHERE
    (CATEGORY.NAME LIKE UPPER(:vName)||'%')) .
    Tested SQL Statement in SQL Worksheet works ok (with a Value replacing ':vName').
    Can anyone advise - seems to be a straight forward process that is returning this error msg. I have tried variations of the SQL stmt with no luck. The jspx page errors when the ADF Read-Only Table is added.

    I seem 2 have the same error, in a slightly different situation.
    I have a view which subclasses a Entity with a history column 'CreatedOn'. When performing a quick search/filter on this column I get the same error. The ADF app is build on a DB2 database, so no named parameters here. Instead invalid SQL is created when executing the estimated row count. The WHERE clause contains 'CreatedOn = null', should be 'CreatedOn is null'. Furthermore the input of my quick search is not filled in this clause.
    Any help would be appreciated

  • 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

  • Trying to get row counts for all tables at a time

    Hi,
    i am trying to get row counts in database at a time with below query but i am getting error:
    its giving me ora-19202 error..please advise me
    select
          table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name))
              ,'/ROWSET/ROW/C')
              count
        from all_tables;

    ALL_TABLES returns tables/views current user has access to. These tables/views are owned not just by current user. However your code
    dbms_xmlgen.getxml('select count(*) c from '||table_name)does not specify who the owner is. You need to change it to:
    dbms_xmlgen.getxml('select count(*) c from '||owner || '.' || table_name)However, it still will not work. Why? As I said, ALL_TABLES returns tables/views current user has access to. Any type of access, not just SELECT. So if current user is, for example, granted nothing but UPDATE on some table the above select will fail. You would have to filter ALL_TABLES through ALL_SYS_PRIVS, ALL_ROLE_PRIVS, ALL_TAB_PRIVS and PUBLIC to get list of tables current user can select from. For example, code below does it for tables/views owned by current user and tables/views current user is explicitly granted SELECT:
    select
          t.owner,
          t.table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.owner || '.' || t.table_name))
              ,'/ROWSET/ROW/C')
              count
        from all_tables t,user_tab_privs p
        where t.owner = p.owner
          and t.table_name = p.table_name
          and privilege = 'SELECT'
    union all
    select
          user,
          t.table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.table_name))
              ,'/ROWSET/ROW/C')
              count
        from user_tables t
    OWNER                          TABLE_NAME                                                          COUNT
    SCOTT                          DEPT                                                                    4
    U1                             QAQA                                                                    0
    U1                             TBL                                                                     0
    U1                             EMP                                                                     1
    SQL> SY.

  • Different row count for select versus insert in XML query

    Hi,
    I encounter a situation where a SELECT * returns a different rows count than an INSERT INTO... (SELECT *) by xmltable join. This makes no sense at all!!!
    In breif, I tried to convert xml data into traditional relational tables. I wrote an xml query to select data from xmltable... I checked row count. When I used "create table as select" that was the same query above, I got correct row count. However when I used "insert into select" that was the same query above, I got the wrong info in the table I just inserted.
    Does any one have any idea what caused this issue? Thanks for your help.

    DUPLICATE post
    count of rows in a schema tables

  • SCOM Powershell get alert count for specific groups

    Hello good people,
    im looking for a powershell script (to use in powershell widget):
    ive got 3 groups which generate alerts, for example group1 group2 group3
    now i need to get all new alerts and closed alerts per group
    groupid  new  closed
    group1    12     100
    group2    10       50
    group3    3         6
    thx for your help in advanced

    you may consider using the following powershell cmdlet to count number of closed alert
    $gp1closed=get-scommonitoringobject|where-object{$_.displayname -eq 'group1'} | get-scomalert | whereobject$_.resolutionstate -eq '255'} |measure
    $gp1open=get-scommonitoringobject|where-object{$_.displayname -eq 'group1'} | get-scomalert | whereobject$_.resolutionstate -eq '0'} |measure
    $gp2closed=get-scommonitoringobject|where-object{$_.displayname -eq 'group2'} | get-scomalert | whereobject$_.resolutionstate -eq '255'} |measure
    $gp2open=get-scommonitoringobject|where-object{$_.displayname -eq 'group2'} | get-scomalert | whereobject$_.resolutionstate -eq '0'} |measure
    $gp3closed=get-scommonitoringobject|where-object{$_.displayname -eq 'group3'} | get-scomalert | whereobject$_.resolutionstate -eq '255'} |measure
    $gp3open=get-scommonitoringobject|where-object{$_.displayname -eq 'group3'} | get-scomalert | whereobject$_.resolutionstate -eq '0'} |measure
    'Group1' + '  '+ $gp1open + '  '+ $gp1closed
    'Group2' + '  '+ $gp2open + '  '+ $gp2closed
    'Group3' + '  '+ $gp3open + '  '+ $gp3closed
    Roger

  • Getting the max count for each group

    Hi, I am a newbie and working on a project for school. I have been working this problem for a couple of days and made a bit of progress.
    I have two tables, student and enroll for a college database. I need to show the students who have the most enrollments in each major. So far, I have:
    WITH COUNT_Q AS
    SELECT B.SSN, B.MAJOR, COUNT (A.CLASS_NO) AS COUNTCLASS
    FROM ENROLL A, STUDENT B
    WHERE A.SSN = B.SSN
    GROUP BY B.SSN, B.MAJOR
    SELECT MAX(COUNTCLASS), MAJOR
    FROM COUNT_Q
    GROUP BY MAJOR
    I am getting the correct results but need to show the SSN and Major of the studens. When I add in the SSN and Major, like below, I get back too many records.
    WITH COUNT_Q AS
    SELECT B.NAME, B.SSN, B.MAJOR, COUNT(A.SSN) AS COUNTCLASS
    FROM ENROLL A, STUDENT B
    WHERE A.SSN = B.SSN
    GROUP BY B.NAME, B.SSN, B.MAJOR
    SELECT *
    FROM COUNT_Q
    WHERE (COUNTCLASS) IN (SELECT MAX(COUNTCLASS)
    FROM COUNT_Q
    GROUP BY MAJOR
    Can someone help point me in the right direction?

    SELECT  B.NAME,
            B.SSN,
            B.MAJOR
      FROM  (
             SELECT  B.NAME,
                     B.SSN,
                     B.MAJOR,
                     COUNT(A.CLASS_NO) SSN_MAJOR_COUNTCLASS
                     DENSE_RANK() OVER(PARTITION BY MAJOR ORDER BY COUNT(A.CLASS_NO) DESC) RNK
               FROM  ENROLL A,
                     STUDENT B
               WHERE A.SSN = B.SSN
               GROUP BY B.NAME,
                        B.SSN,
                        B.MAJOR
      WHERE RNK = 1
    /SY.
    Edited by: Solomon Yakobson on Mar 27, 2011 6:53 PM

  • How to increase the row count for display in OBIEE Answers-Dashboard page?

    Hi All,
    I have problem in exporting my reports. I need to export my report to either PDF or EXCEL format. My report contains more than 1200 rows. But when i am exporting the report to PDF it contains only 500 rows, for rest of the rows i have to scroll down and again i have to export to get the contents from 501 to 1000.
    Is it possible by changing any property, can i export the entire 1200+ rows in a single EXCEL or PDF? Pls anybody shed light on this issue.
    Thanks in Advance
    Thenmozhi.

    Hi,
    D:\Oracle\Middleware\instances\instance1\config\OracleBIPresentationServicesComponent\coreapplication_obips1\instanceconfig.xml
    before take it u r back up and then update the below code ..
    <Views>
    <Pivot>
    <MaxCells>6500000</MaxCells>
    <MaxVisibleColumns>100</MaxVisibleColumns>
    <MaxVisiblePages>1000</MaxVisiblePages>
    <MaxVisibleRows>65000</MaxVisibleRows>
    <MaxVisibleSections>25</MaxVisibleSections>
    <DefaultRowsDisplayed>500</DefaultRowsDisplayed>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>65000</DefaultRowsDisplayedInDownload>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DisableAutoPreview>false</DisableAutoPreview>
    </Pivot>
    <Table>
    <MaxCells>6500000</MaxCells>
    <MaxVisiblePages>1000</MaxVisiblePages>
    <MaxVisibleRows>65000</MaxVisibleRows>
    <MaxVisibleSections>25</MaxVisibleSections>
    <DefaultRowsDisplayed>500</DefaultRowsDisplayed>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDelivery>75</DefaultRowsDisplayedInDelivery>
    <!--This Configuration setting is managed by Oracle Business Intelligence Enterprise Manager--><DefaultRowsDisplayedInDownload>65000</DefaultRowsDisplayedInDownload>
    </Table>
    </Views>
    finally re start all services then try it again... here its working fine...
    Thanks
    Deva

  • How can we split limit row counts for DB2?

    We want to mass data from DB2. but, we guess 200,000,000 count.
    so we try to split by 5,000 count and almost 5 MB.
    How can we use sql query for DB2? How can we make JDBC Sender?
    but, We don't use update query. because Customer did not allow ours requirement.
    How can we do?

    Well, there are ways, how to achieve success, but in all of them must customer do some changes in their database.
    a, create "interface table", run select into (load relevant data to it) and then run JDBC adapter select on this table using update statement to mark the processed lines
    b, there is for sure a table, which is "main" - every record is replicated and every one is repliacted only once.. Add new column to this table and use it as a "marker" for already processed records..
    ...for example...
    There may be of course more possibilites...
    If you don't want to process all records at once, there must be some flag to distinguish already processed records from not processed ones..
    Peter

  • Row count for tables from 2 different databases

    Hi,
    i wrote a query to get counts from all the tables in one schema to another schema. this generates the select count (*) from tables and gives me the counts, but i want to get the counts such as
    table1 -- 100 -- DB1
    table1 - 110
    table2 - 230 - DB2
    table2 - 230 etc...
    here is my query that works but display of the output is the way i wanted. can someone help me getting the output as above described.
    select 'select ''PTO'', count(*) as '||(table_name)||'_count'||' from '||table_name||';'from dba_tables
    where owner = 'TEST'
    union all
    select 'select ''PFO'', count(*) as '||(table_name)||'_count'||' from '||table_name||';'from [email protected]
    where owner = 'TEST';
    thanks...

    DUPLICATE post
    count of rows in a schema tables

  • SQL Query for getting Row No for each group

    Dear Oracle Gurus,
    I want to allocate Rownum to each group. How we can do this with single SQL. Help me on this.
    Thanks

    select deptno, ename, row_number() over (partition by deptno order by ename) from emp order by 1,3;

Maybe you are looking for

  • Premiere Pro CS6 not responding after adding anything to timeline

    I had been using Premiere CS6 successfully for a while, but starting a few months ago, it started not responding after I did anything.  I can add a title and a transition succesfully to the timeline and it plays fine, but as soon as I add a picture o

  • Problem with USB Disk

    I have an Airport Extreme, and have connected a disk. Airport Extreme has a yellow light, says there is a disk error. I connect to my Mac Pro and run disk utility, there is no error. Reconnect to Airport and yellow light, disk error. Something is wro

  • FCP Crash on Long Render/Can't Output to Tape

    My project file size is about 350MB and is layered heavily with Sapphire effects (primarily lighting effects). If I attempt to render the entire 30 minute sequence, FCP crashes about 1.5 hrs into the render. Is this a RAM issue? I have a 3GHz Dual Co

  • Gmail error "The user name or password for Gmail is incorrect"

    Starting the other day I am getting the above error when I try to access my gmail account on my iphone4 and I get the same error on my iMac. This is the 2nd or maybe 3 time this has happened. The last was exactly month ago. Also keep in mind I can ac

  • Impossible de mettre a jour iphone

    Bonjour j'ai un 3GS avec une version logicielle 4.2.1 et il m'est impossible d'installe une autre version plus recente. Que faire? Merci