SSRS- Counting the number of occurrences

Hi,
I have table 1 filled with numbers 1-5. I need to count the number of occurrences for each number in table 2.
For example,
Table 1
3
4
5
4
3
Table 2 1-- 0 occurrences 
2-- 0 occurrences
 3-- 2 occurrence
 4-- 2  occurrences
 5-- 1  occurrences
Can I do this in a SSRS report?
Thank you in advance!

Hi Rebecca07,
After testing the issue in my local environment, we can refer to the steps below to achieve your requirement:
Drag a table from Toolbox to design surface.
Delete the detail row (second row) and the third column.
Right-click the first row to insert five rows after that row.
Type the following expressions in each cell:
numbers             occurrences
1                        =count(iif(Fields!number.Value=1,1,nothing))
2                        =count(iif(Fields!number.Value=2,1,nothing))
3                        =count(iif(Fields!number.Value=3,1,nothing))
4                        =count(iif(Fields!number.Value=4,1,nothing))
5                        =count(iif(Fields!number.Value=5,1,nothing))
The following screenshot is for your reference:
If you have any other questions, please feel free to let me know.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support

Similar Messages

  • How do I count the number of occurrences of a string within a group of cells?

    Hello all, I'm trying to figure out how to count the number of times a child has completed certain tasks.  Here is a sample of the data (it is highly simplified here, but contains what I hope is needed to answer my question):
    Unnamed Table
    Objective
    John
    Ann
    Alex
    Dave
    Eric
    20a 20b 20c
    x
    20a 20b 20c
    x
    20a 20b 20c
    x
    x
    19b 20a
          x
           x
    20c 21b 22
         x
    What I am trying to do is count the number of times each child completed each objective - but I can't figure out how to go about splicing up the "objectives" fields for counting while still being able to compare them to whether or not the "child" has 'an x in the box' in that particular row.

    If I read your example correctly, John's counts should be 2 for 20a, 1 for 19b, 20b and 20c, and 0 for any other objectives listed.
    Here's an example that will work for your data set, assuming that any objective ma occur only once in each row of column A of the Main table. I've added an a to objective 22, but I think it is unnecessary, provided there is no objective 122, 221, etc.
    This uses a two step process.
    The table AUX extracts the objectives completed by each student, using the checkboxes in Main. Note that it also adds a space at the beginning and end of each string. This provides an extra character before the first objective code and after the last objective code in that row, used by the wildcard specification in the formula in the Summary table.
    Formula:
    Aux::B2: =IF(OFFSET(Data :: $A$1,ROW()-1,COLUMN()-1)," "&OFFSET(Data :: $A$1,ROW()-1,0)&" ","")
    Fill right to the last column and down to the last row of Aux.
    Summary uses COUNTIF to count the number of occurrences of each of the objectives listed in column A of that table.
    Formula:
    Summary::B2: =COUNTIF(Aux :: B,"=*"&$A2&"*")
    Fill right and down as the previous formula.
    Regards,
    Barry

  • Count the number of occurrence in a string

    is there any api for counting the number of occurrence in a string or should i write a method myself?
    for example. I want to count "." in "1.2.3.4.". i want to count the dot in this string.
    I am just wondering.
    Thanks in advance.

    is there any api for counting the number of
    occurrence in a string or should i write a method
    myself?The latter.

  • Using count to count the number of occurrences of a primary key

    Hi,
    I'm relatively new to T-SQL and more of a SAS guy.
    I just need to some help.
    I have a table
    CF_ID    Name
    4444     Mark
    4444    Mark
    3321   Sarah 
    All i want to do add in a new column to count the number of occurrence of the CF_ID. So my new table would be:
    CF_ID    Name     New_column
    4444     Mark       1
    4444     Mark       2
    3321     Sarah     1 
    Any help would be gratefully appreciated.
    Thank you
    Umar Javed

    Hello Umar,
    You can use the
    ROW_NUMBER (Transact-SQL) for this:
    SELECT *, ROW_NUMBER() OVER (PARTITION BY CF_ID ORDER BY Name) AS New_Column
    FROM yourTable
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • 'COUNT' the number of occurrences of a characteristic in BEx

    Good day all.
    3.x BEX.
    I want to count all the occurrences of a " Claim Number" in a BEx query.
    The u201CClaim numberu201D might have several u201Clinesu201D ie : Claim number u201CMMC123u201D has line 1, 2 and 3. I only want to count it as u20181u2019 Dealer claim number, not u20183u2019.
    I have a InfoObject "Counter" in DSO and transformation that counts all the lines, not just the claim numbers. If I set the counteru2019s key figure properties (calculate single value as..) to u2018minimumu2019, I will receive the correct quantity of lines when u201Cclaim numberu201D is displayed in the query results. BUT, I only want to display the total in the query (no detail).
    If I remove the Dealer claim number from the result, then the total displayed includes all the lines for the claim number as well.
    How do I get the correct quantity to display?
    Thanks in advance.
    Cj

    Hi,
    Use exception aggregation for Keyfigure (counter) Properties with referce to the char Claim Number.
    Goto->Counter(KF)Properties->exception aggregationTab-->select refchar(Claim Number)-->ok.
    then u will get aggregation value.
    Hope it willhelp.
    Regards,
    Satya

  • Count the number of unique values in column

    Hi
    I have a large numbers file (thousands of rows) with data for different dates. I need to calculate the number of unique (distinct) dates are in the spreadsheet.
    Does anyone know how to do this?
    Thanks,
    Bruce

    bpj,
    Let's say your date is in column B for this example and your first data row is Row 2. In another column you can enter into row 2: =IF(COUNTIF($B$2:B2, B)=1, 1, "") Summing the new column content will yield the number if unique dates.
    As badunit observes, this will result in sluggish document. If the number of possible dates is small compared to the number of rows of data, it would be better to make a table of possible dates and count the number of occurrences of each of those dates in the data, a COUNTIF function on the frequency data for the date range will give you the number of unique dates, possible much more efficiently.
    Jerry

  • How to Count the number of TAB chars value '0A' in a line?

    I have a requirement to count the number of TABs in a text file that I am processing (they must equal 75) to ensure that all the fields have been submitted on the file I am reading?
    How do I identify the TABs in a line?
    I have this so far:
             CONCATENATE gv_unix_file gv_lstfiles-name INTO gv_unix_file.
              OPEN DATASET gv_unix_file for INPUT IN TEXT MODE ENCODING NON-UNICODE.
              IF sy-subrc <> 0 .
                message e000(zz) with 'Cannot access in_uk files'.
              ENDIF.
              CONCATENATE gv_unix_file_arc gv_lstfiles-name INTO gv_unix_file_arc.
              OPEN DATASET gv_unix_file_arc FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
              IF sy-subrc <> 0 .
                message e000(zz) with 'Cannot access in_uk files'.
              ENDIF.
              DO.
                READ DATASET gv_unix_file into lv_str.
                IF sy-subrc <> 0.
                  exit. "exit do loop, file is done.
                else.
                  TRANSFER lv_str to gv_unix_file_arc.
                ENDIF.
              ENDDO.

    Here is a sample code:
    DATA: lv_string TYPE string,
          lv_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
          lv_i TYPE i.
    DATA: result_tab TYPE match_result_tab.
    DO 3 TIMES.
      CONCATENATE 'A' lv_string INTO lv_string SEPARATED BY lv_tab.
    ENDDO.
    " this is how you need to find how many tabs are in your transfer work area...
    FIND ALL OCCURRENCES OF lv_tab IN lv_string RESULTS result_tab.
    DESCRIBE TABLE result_tab LINES lv_i.
    WRITE:'No. of tabs found:', lv_i.

  • Need help in finding the number of occurrences of a pattern.

    Hi All,
    I need help in finding the number of occurrences of a pattern in a table's column's data.
    Consider sample data - one row's column from a table:
    "S-S-S-A-S-S-P-S-S-B-S-A-P-S-S-C"
    My requirement is:
    I should get the count of S's which are immediately preceded by A or P.
    for the above data i should get count as 3+2+1=6 (S-S-S-A, S-S-P, S-A)
    The pattern data is stored as VARCHAR2 type.
    Thanks in advance,
    Girish G
    Edited by: Girish G on Jul 21, 2011 11:22 PM

    I am sure there exists a better way then this one:
    SQL> with dt as
      2  (select 'S-S-S-A-S-S-P-S-S-B-S-A-P-S-S-C' str from dual)
      3  SELECT SUM(Regexp_count(Regexp_substr(str, '(S\-?)+(A|P)+', 1,
      4                                     Regexp_count(str, '(S\-?)+(A|P)+') - (
      5                                                  LEVEL - 1 )), 'S')) len
      6  FROM   dt
      7  CONNECT BY LEVEL <= Regexp_count(str, '(S\-?)+(A|P)+')
      8  /
           LEN
             6

  • Can i count the number of Mondays in a specific month with a formula?

    Hi
    I am looking for a streamlined way of calculating an amount to invoice for a job that I am paid for weekly, but for which I invoice monthly, meaning that I am invoicing different amounts each month, depending on how many Mondays fall in a given month (i.e. 4 or 5).
    So I am wondering if there is a function I can use to calculate the number of Mondays in a given month automatically and then I can use this value to multiply by my weekly charge to calculate the amount to invoice each month.
    Thanks
    Nick

    Responses below apply to my earlier post.
    nick_harambee wrote:
    1. What part of the formula do I need to change to do the same for other days of the week, and for other years?
    No change for other years, as the full date is entered.
    I haven't looked at changes necessary to the version above to show results for other days. See below for a new table that does all days.
    2. Would it be possible to construct one table with the calendar for a whole year, which would generate a count for each day of the week, which I could then use as and when needed? Or would it make more sense to construct a separate table for each day of the week (as I am referring to in question 1)?
    Depends what information you need.
    If you need the count for only one week day, then a table showing only the count for that day of week will avoid having to search it out.
    If you need the number of occurrences of each weekday in each month, then a table showing those, with or without an attached calendar, is in order.
    Here's one that shows the count of each weekday for each month. It uses two formulas, derived from the earlier posts by Yvan and Jerry:
    B1: =DATE($A,COLUMN()-1,1)
    B2: =IF(AND(DAY(EOMONTH(B$1,0))>28,MOD(WEEKDAY(EOMONTH(B$1,0))+7-(ROW()-1),7)<(DAY( EOMONTH(B$1,0))-28)),5,4)
    The formula in B1 is filled right to M1, and the cells are formatted to show only the Month and Year. Note that the cells actually contain Date and Time values, which are used in the second formula's calculations.
    The formula in B2 is filled right to M2 and Down to M8.
    Day names in column A are entered directly and are not used in the calculations.
    The 4 digit year number is entered directly in A1. Change this number to change the year.
    <img src="http://i963.photobucket.com/albums/ae116/Barry_images/iWork09screen/Countw eekdaysinMonth.png" border="0" alt="Count of weekdays in month(s)">
    Conditional formatting is used to fill cells whose value is equal to 5 with a yellow background.
    Regards,
    Barry
    Edit:
    Direct address to image for use if not showing above.
    http://i963.photobucket.com/albums/ae116/Barry_images/iWork09screen/Countweekday sinMonth.png
    Message was edited by: Barry

  • How to count the number of occurences of a character

    hi
    wat command is used to count the number of occurences of a charcter in a line?
    i have to count the number of '.' in a line

    FIND
    Searches for patterns.
    Syntax
    FIND <p> IN [SECTION OFFSET <off> LENGTH <len> OF] <text>
                [IGNORING CASE|RESPECTING CASE]
                [IN BYTE MODE|IN CHARACTER MODE]
                [MATCH OFFSET <o>] [MATCH LENGTH <l>].
    The system searches the field <text> for the pattern <p>. The SECTION OFFSET <off> LENGTH <len> OF addition tells the system to search only from the <off> position in the length <len>. IGNORING CASE or RESPECTING CASE (default) specifies whether the search is to be case-sensitive. In Unicode programs, you must specify whether the statement is a character or byte operation, using the IN BYTE MODE or IN CHARACTER MODE (default) additions. The MATCH OFFSET and MATCH LENGTH additions set the offset of the first occurrence and length of the search string in the fields <p> and <l>.

  • Is there a way to count the number of times an array moves from positive to negative?

    I have an array of values, and I need to find the number of times that the array changes signs (from positive to negative, or vice versa). In other words from a graphical standpoint, how many times a certain line crosses the x-axis. Counting the number of times the array equals zero does not help however, because the array does not always equal exactly zero when it crosses the axis (ie, the points could move from .1 to -.1).
    Thanks for you help. Feel free to email me at [email protected] I only have lv 5.1.1 so if you attach any files, they cannot be version 6.0.

    Attached is a VI showing the # of Pos and Neg numbers in an array, with 0 considered as non-Pos. It is easily modifiable to other parameters - including using the X-axis value as your compare point versus only Zero.
    This is a modified VI from LV (Separate Array.vi)
    Compare this with your other responses to find the best fit.
    Doug
    Attachments:
    arraysizesposneg.vi ‏40 KB

  • How do I count the number of records returned in the CMIS query

    How do I count the number of records returned in the query CMIS?
    SELECT COUNT(*) FROM ora:t:IDC:GlobalProfile WHERE ora:p:xRegionDefinition = \'RD_PROJETOS_EXCLUSIVOS\''}
    Euler Homero

    Hi Euler,
    interestingly enough, the reference guide for CMIS ( http://wiki.alfresco.com/wiki/CMIS_Query_Language ) that I found does not mention the COUNT function at all. On the other hand it states that: "The SELECT clause identifies which virtual columns to return in the result set. It can be either a comma-separated list of one or more queryNames of properties that are defined by queryable object types or * for all virtual columns."
    There are, however, some other posts like e.g. http://alfrescoshare.wordpress.com/2010/01/20/count-the-total-number-of-documents-in-alfresco-using-sql/ which state that they could make it working.
    Having asked in the WebCenter Portal forum, I assume that your content repository is WebCenter Content. The CMIS doc for the Content is available here: http://docs.oracle.com/cd/E23943_01/doc.1111/e15813.pdf (no COUNT there either). It does, however, mention explicitly that "CMIS queries return a Result Set where each Entry object will contain only the properties that were specified in the query.". This means your could rather investigate the Result Set. Note that there are also other means than CMIS how to get the requested result set (e.g. calling a search service directly via so-called RIDC).
    In the given context I am also interested what your use case is. OOTB CMIS in WebCenter Portal is used, for instance, in Content Presenter, where it is content rather than "parameters" what's displayed.

  • How to count the number of rows in a cube!!??

    Experts,
    I can somebody tell me how do I count the number of rows in my cube when i am using listcube???..
    Thanks
    Ashwin

    Hi,
    have a look ath this theard too
    Number of Records in Cube
    regards

  • How to count the number of rows in a resultser object?

    hi there
    how to count the number of rows in a resultser object which may contains millions of rows? besides using a while loop? thanks

    You don't, you execute a query whose result is the record count of those records that match the search and then you execute the actual query to create your record set. Typically you do
    select count(id) from YourTable where [filter]
    from the resulting ResultSet do
    int res.getInt(1);
    which gives you the count and then
    select id from YourTable where [filter]
    to produce the actual result set.
    in the second query the id part can be substituted with the actual fields you want.

  • Programatically count the number of files in a folder

    Hi Folks
    I need to programatically count the number of files in a given folder and return the value to a Program Unit to be included in further processing.
    Can anyone point me in the right direction. I have looked at UTL_FILE but this does not offer what I want.
    Does anyone know of an obscure package in Oracle that I could use?
    I'm using 9i in a W2K environment.
    Many thanks
    Simon Gadd

    Hi,
    following a java based solution i found somewhere on Tom Kyte's AskTom forum.
    GRANT JAVAUSERPRIV to TESTUSER;
    dbms_java.grant_permission( 'TESTUSER', 'SYS:java.io.FilePermission', 'c:\', 'read' );
    create global temporary table DIR_LIST
    ( filename varchar2(255) )
    on commit delete rows
    create or replace and compile java source named "DirList"
    as
      import java.io.*;
      import java.sql.*;
      public class DirList
        public static void getList(String directory)
                           throws SQLException
          File path = new File( directory );
          String[] list = path.list();
          String element;
          for(int i = 0; i < list.length; i++)
              element = list;
    #sql { INSERT INTO DIR_LIST (FILENAME)
    VALUES (:element) };
    create or replace procedure get_dir_list( p_directory in varchar2 )
    as language java
    name 'DirList.getList( java.lang.String )';
    exec get_dir_list( 'c:\temp' );
    select count(*) from dir_list;

Maybe you are looking for

  • How can i import contacts from another AIM account to this new one

    If you reference my last ichat question, you will see that I have had serious problems and had to create a new account. How can I import contacts from another AIM account to this new one??

  • Oracle SQL-92 Non compliance:  When will oracle support empty strings?

    Oracle is the only database on the planet that equates an empty string to a null value. For several major versions, Oracle has said "Make sure you don't rely on null and empty string equivalency because it could go away in the future." When will Orac

  • 3 Levels Search help

    I am using jdev 11g(version 11.1.2.0.0). I created a schedule object for a table with which has 3 level searching.first level is region, second level is country and third level is port. the query for region is ... select distinct pol_region from vw_s

  • Having a problem downloading acrobat in CS6 Master collection

    Exit Code: 6 Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW050 ... WARNING: DW066 ... -------------------------------------- Summary -------------------------------------- - 0 fatal error(s), 3 error(s), 1

  • Line Messenger

    I read a post in the Line blog saying that Line and Nokia teamed up for making avialable Line Messenger on Asha phones... This is the link http://en.lineblog.naver.jp/archives/24924144.html I want to ask something, are you gonna make avialable Line M