How to Create Small Sample Sizes in Cognos
This document shows an example of data in small sample sizes in Cognos.
Steps to Take
- 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
- Select Toolbox icon as highlighted in yellow and double click on Query Calculation as indicated in red arrow
- You will see the following screen:
- On this screen:
- Enter Name as ‘Calculated Student Count’
- Enter ‘Case when’ inside the Expression Definition box and the syntax of case [expression] when ...end statement will show up within the information box.
- Click on Data items then Double Click on Student Count
- [Student Count] will automatically be added inside the Expression Definition box
- 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
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.
- Click on Validate icon as indicated in red arrow and ‘No errors’ is shown inside the Information box.
- Click on Run Options icon as indicated in red arrow and select Run HTML
- The Report Output is shown as below