How to Create Small Sample Sizes in Cognos




This document shows an example of data in small sample sizes in Cognos.

Steps to Take


  1. Use ‘SAH-Enrollment-View’ as the data source and include ‘Term Code’ and ‘Graduate Primary Major’ and ‘Student Count’ data fields in the Cognos list report

  2. Select Toolbox icon as highlighted in yellow and double click on Query Calculation as indicated in red arrow

  3. You will see the following screen:

  4. On this screen:
    1. Enter Name as ‘Calculated Student Count

    2. Enter ‘Case when’ inside the Expression Definition box and the syntax of case [expression] when ...end statement will show up within the information box.

    3. Click on Data items then Double Click on Student Count 

    4. [Student Count] will automatically be added inside the Expression Definition box

    5. Put in the following syntax inside the Expression Definition:

      For [Student Count] as shown in Case when [expression]…End statement, you just need to double click on Student Count data field and it will be added to the Case when[expression]…End statement.

      Case when [Student Count]<10
      Then 'Count<10'
      Cast([Student Count], varchar(8))


      Note: Use String data type after Then and Else statement. That is why we have to use Cast([Student Count], varchar(8)) function to convert Student Count data field from Numeric data type to String data type for Else statement use.

  5. Click on Validate icon as indicated in red arrow and ‘No errors’ is shown inside the Information box. 
    Click OK.

  6. Click on Run Options icon as indicated in red arrow and select Run HTML

  7. The Report Output is shown as below


If you still have questions or need additional assistance, please submit a ticket or email