Logging in and creating a folder for your work
- Because of high interest in today’s session we are using a single 96 core 768 GB RAM Cognos server with anonymous access allowed. This makes logistics much easier but means we don’t have access to the ‘My content’ feature of Cognos.
- Click here to access Cognos: http://22.214.171.124:9300/
- Click ‘Team content’ and navigate to the ‘BACon Users’ folder.
- Click the ‘+’ button in the navigation window and select ‘Folder’.
- Give your folder a name with the following format: Initials – favorite movie – favorite color. In my case it would be ‘RPD-Solyaris-Green.’ Hopefully this ensures a unique folder for everyone.
- We are now ready to begin today’s class.
Organizing for Self Service with Data Sets
In our first example we will prepare a data set for self-service. This data set is sourced from an existing Framework Manager package and is a good example of a technique PMsquare often uses to simplify presentation and improve performance for end users. We will cover the basics of creating a data set, optimizing its performance and using it in a dashboard.
Creating a data set off a relational package
- Click ‘Team content’ on the left side of the screen and Navigate to Team Content>BACon Modules.
- Hover over ‘Go data warehouse (query) package and click the ‘More’ button.
- Select ‘Create data set’ from the ‘More’ menu. The data set screen will launch.
- The data set screen might look familiar – it is a stripped down version of Cognos Analytics report authoring. You should see a ‘Source’ section with the ‘Go data warehouse (query)’ package loaded, and an area that reads ‘Add data here’.
- Expand the ‘Sales Target (query)’ folder under ‘Insertable Objects’.
- Expand the ‘Sales Target (query)’ namespace located within.
- From the namespace, drag the following fields to the ‘Add data here’ section of the screen. A list will appear and populate with data from the package:
- Retailer.Retailer country
- Retailer.Retailer name
- Retailer.Retailer code
- Employee by region.Employee name
- Employee by region.Position name
- Time.Month key
- Time.month (numeric)
- Sales target fact.Sales target
- Click the ‘Page design’ drop down and select ‘Page preview’.
- Turn off ‘Summarize detailed values…’ and observe the effect of summarization on the data displayed in the list. The underlying data is at the level of individual Target transactions.
- Turn detail summarization back on.
- Click the ‘Year’ column and select ‘edit layout sorting’ from the sorting drop down menu in the toolbar.
- Drag ‘Year’ and ‘Month (numeric) to the ‘Detail Sort List’ and click OK. We have sorted our data set by year and month. Sorting on commonly used columns can improve performance.
- Click ‘Position name’ and select ‘Create custom filter’ from the filter drop down menu in the toolbar.
- Click ‘Condition’ to access the conditional filter screen
- In the ‘Input condition’ next to ‘Contains’, type ‘Sales’. This will filter the Position Type column for values that contain the word ‘Sales’. Removing unnecessary rows or columns can improve performance.
- Click the ‘Save’ icon and select ‘Save as’.
- In the ‘Save as’ window, navigate to ‘Team Content > BACon user>your folder. This is the folder you created in step 5 of Getting Started.
- In the ‘Save as:’ text box, type ‘Sales Target Data Set’.
- Click ‘Save’. The ‘Save as’ window will close.
Finding and loading a data set
- Click the ‘Home’ icon to return to the Cognos Analytics welcome screen.
- Click ‘Team content’ on the left side of the screen and navigate to ‘Team Content>BACon users>your folder’.
- Hover over ‘Sales Target Data Set’ and click the ‘More’ button.
- Select ‘Reload’. The Data Set loading notification will appear at the top of the screen. It should load and disappear fairly quickly.
- In the ‘More’ menu, select ‘Properties’.
- In the ‘Properties’ menu, notice the created, modified and data refreshed dates & times in the upper right.
- In the ‘Properties’ menu, expand ‘Advanced’ and scroll down to see statistics about this data set:
- Number of rows
- Number of columns
- Time to refresh
- Refreshed by
- Close the properties menu.
- Click the ‘More’ button next to ‘Sales Target Data Set’ and select ‘Create dashboard’ in the ‘More’ menu.
- Select the fourth available template in the ‘Create dashboard’ screen. It has a large rectangle in the center with four rectangles equally spaced at the top.
- Click ‘Okay’. The ‘New dashboard’ screen will load.
- On the left side of the screen, click on the ‘Assistant’ icon.
- Type ‘Show average sales target for country’ and hit enter. Note that Sales target total is a sum measure, not an average. Cognos is able to compute new aggregate types on the fly using natural language query.
- Click and drag the map that appears into the ‘drop here to maximize’ icon in the center of the screen.
- Drag ‘Retailer region’ next to the ‘This tab’ icon at the top of the screen to add it to the tab filters.
- Click the ‘Retailer region’ filter and select ‘Northern Europe’. The map will zoom to extent.
- Add additional visualizations to the dashboard as you see fit.
- Save your dashboard as ‘Employee Target Dashboard’.
Combining data sets with other sources using data modules
Data sets alone are great for simple requests; for more complex modeling requirements containing multiple tables, complex relationships or relative time you are better off creating a data module. Data modules can contain multiple data set, data base or excel data sources and are great for IT and power users alike.
Creating a data module
- Click the ‘Plus’ button in the lower left side and choose ‘Data Module’
- In the ‘Select sources’ menu, select ‘Team Content’. Navigate to ‘your folder in ‘BACon users’
- Select ‘Sales Target Data Set’ and click ‘OK’. The data modules screen will open.
- Click the table ‘Sales Target Data Set’ in the source view. This will load a preview of the data from your data set into the ‘Grid’ tab. Here you can easily make comparison for join compatibility and instantly see the results of any filters, groups or calculations you build
Adding additional data sources
- Click the ‘+’ icon in the data source view and select ‘Add new sources’
- Click ‘Data servers and schemas’ and click ‘GOSALESDW/gosalesdw’. Click ‘OK’.
- Click ‘Discover related tables’ and explore the natural language model generation capability a bit. Then click ‘Previous’
- Click ‘Select tables’ and click ‘Next’.
- Choose ‘Go Time Dim’ from the available sources and click ‘OK’. This will add the Go Time Dim table to our data module.
- Repeat the above process to add:
- Great_outdoor_sales data server
- GOSALES/gosalesrt schema
- Retailer table
- Retailer Site table
- Retailer Type table
- GOSALES/gosalesrt schema
- Team content>BACon>BACon files
- Sales data excel.csv
- Great_outdoor_sales data server
- At this point you should have six tables in your data module:
- Sales Data Excel.csv
- Retailer Site
- Retailer Type
- Go Time Dim
- Sales Target Data Set
- Save the model as ‘Sales Analysis Date Module’ in ‘your folder’.
Data cleanup and prep
- Click the arrow next to the ‘Go Time Dim’ table to expand it. Notice the large number of fields with a ruler icon. Cognos has incorrectly identified these as measures.
- Ctrl-click each ruler icon the click the ‘properties’ icon in the upper-right corner of the screen. This will open the properties window.
- Change ‘Usage’ from ‘Measure’ to ‘Attribute’. Change ‘Represents’ to ‘Time’.
- Click the ‘Month De’ field then shift-click the ‘Weekday Tr’ field. This will select all the non-english fields in the table.
- Click the ‘more’ button and select ‘Remove’. This removes these fields from the model.
- Repeat this process in the ‘Retailer Type’ table to leave only ‘Retailer Type Code’ and ‘Type Name En’.
- Save your work.
Simplify table structure
- Click the ‘more’ button next to ‘Sales Analysis Data Module’ in the source view. Select ‘Table’ in the menu that appears.
- Click ‘Select Tables’ and select the three retailer tables.
- Click ‘Create a view of tables’ and click ‘Next’
- Rename the new table ‘Retailer Dim’
- In the ‘Selected Items’ menu, select the following fields:
- Retailer Code
- Company Name
- Rtl City
- Rtl Prov State
- Rtl Country Code
- Type Name En
- Click ‘Refresh’ to check your work. Click ‘Finish’ to create your new table.
- Examine your handiwork in the ‘Custom tables’ tab. This tab makes understanding the data flow in your model much easier.
- Save your work.
- Ctrl-Click ‘Sales Data Excel.csv’ and ‘Go Time Dim’.
- Right-click one of them and choose ‘Relationship’ under the ‘New’ header. This will open the new relationship screen
- Click each table to select it, then right click and select ‘Create relationship’. The create relationship screen will open.
- Ensure the 1 indicator is under ‘Go Time Dim’ and the N indicator is under ‘Sales Data Excel.csv’. You can swap these by clicking the wheel icon in the lower left corner of the screen.
- Select ‘Day key’ from each table and click ‘Match selected columns’ This will create the necessary join criteria.
- Click ‘Refresh’ to see a preview of your join.
- Click OK to build the join.
- Repeat this process to create the following joins:
- Go Time Dim 1-N Sales Target Data Set
- Sales Target Data Set N – 1 Retailer Dim
- Retailer Dim 1 – N Sales Data Excel.csv
Refining and enhancing the model
Adding additional business logic can greatly enhance the value of your data module and make it much easier for professional and self-service authors to quickly create valuable content.
- Ctrl-click ‘Quantity’ and ‘Unit sale price’ in the Sales Data Excel table.
- Click the ‘more’ button and choose ‘create calculation’.
- Name your calculation ‘Sale Total’ and select ‘x’ from the calculation drop down menu.
- Note the ‘Calculate after aggregation’ option on this screen.
- Click ‘OK’
- Repeat the steps above to create the following calculations:
- Cost total: Quantity x Unit cost
- Sale margin: Sale total – Cost total
- Plan variance: Sale total % Planned revenue
- Click the ‘more’ button next to the Sales Data Excel table and select ‘calculation’. This will open the advanced editor.
- Name your calculation ‘Sales Margin’.
- Copy-paste the following logic:
- (Revenue – Cost_Total)/ Revenue
- Click the ‘more’ button next to ‘Sales margin’ and select ‘Format data’.
- Select ‘Percent’ in the drop down. Click ‘OK’.
- Ctrl-click ‘Cost total’ and ‘Sale total’. Click the ‘more’ button and select ‘format’
- Select ‘Currency’ in ‘Format type’.
- Select ‘USD’ in the ‘Currency’ drop down.
- Click ‘OK’
Adding drill paths
- Expand the ‘Go time dim’ table and click the ‘more’ button next to ‘Current Year’.
- Select ‘Create navigation’ path.
- Name the navigation path “Time’
- Drag ‘Current Quarter’, ‘Current Month’ and ‘Day Date’ into the navigation path. Click ‘OK’
- In the source view, click the ‘Identify navigation path members’ button.
- Repeat the process to create the Retailer location path:
- Rtl Country Code
- Rtl Prov State
- Rtl City
- You can create any hierarchy you want – feel free to make something crazy!
Adding relative time
- Click the ‘Add new sources’ button and select ‘Add new sources’.
- Navigate to ‘Team content>Calendars’ and select ‘Fiscal calendar’. Click OK. The Fiscal Calendar table should be visible in your module.
- Expand ‘Go Time Dim’ table and click ‘Day date’. Open the column properties.
- Under ‘Lookup reference’ select ‘Fiscal Calendar’
- Expand ‘Day Date’ and note the large number of relative time filters.
- Expand the ‘Sales Data Excel.csv’ table and shift-click the calculations we made above.
- Click the ‘more’ button and open the properties
- Set the lookup reference to Go Time Dim.Day Date.
- Expand any of the calculations and note the large number of relative time calculations.
Cleaning up for consumption
- Open the properties for ‘Sales Data Excel.csv’ and change the name to ‘Sales’.
- Change ‘Sales target data set’ to ‘Sales target’.
- Click the ‘more’ button next to ‘Sales Analysis Data Module’ and select ‘Folder’ in the ‘New’ section.
- Name the folder ‘Retailer tables’
- Click and drag the ‘Retailer’, ‘Retailer Site’ and ‘Retailer Type’ tables into the ‘Retailer tables’ folder. This will nest the tables within the folder.
- Click the ‘more’ button next to the ‘Retailer tables’ folder and select ‘Hide from users’.
- Click the ‘Source view’ button.
- Expand ‘gosalesrt’ data server.
- Click the ‘more’ button next to ‘Retailer’ and select ‘set data security’.
- Click ‘Add security definition’ in the properties window. This will open the security window.
- Name your security filter ‘Analytics users’
- Expand the ‘Cognos’ namespace and select ‘Analytics users’. Click ‘OK’.
- Selected ‘Company Name’ from the Filters drop down and click ‘Add a filter’. The filter window will open.
- Select ‘4 golf only’ and click ‘OK’
- This sets the data level security at the data server level, not on the level of your individual model! Changes made here will effect ALL models built on this data server, for better or worse.
- Click ‘Cancel’ to leave the security window.
- Click ‘New’ and select ‘Data module’
- Navigate to the ‘Sales Analysis Data Module’ located in ‘your folder’. Click ‘OK’
- Notice how each table is now turquoise with a ‘link’ icon on it. These are linked tables and will inherit changes made to their parent module.
- Check the ‘more’ menu on the ‘Sales’ table. Note that many options are missing. The same is true for individual data items.
- Note the ‘Break link’ option in the ‘more’ menu. This will disconnect the linked table from it’s parent and it will no longer inherit changes. The ability to click this button can be turned off in security.
In this workshop we combined a data set sourced from a Framework Manager package tables from a Microsoft SQL Server database and an Excel spreadsheet into a single data module, which we made available to self-service and professional authors.
I hope this workshop has unlocked a deeper understand of how the Cognos Analytics data prep features can drastically reduce the time it takes to acquire, model and visualize data for both self-service users and IT professionals. As always, please contact me at firstname.lastname@example.org with any questions!