Showing posts with label Cognos Tips. Show all posts
Showing posts with label Cognos Tips. Show all posts

Tuesday, January 31, 2017

Display the top 10 records using the Rank function in Cognos

Use the Rank function and then filter the top 10
Steps:Use the function Rank to obtain the ranking for each data item.
The rank column has this calculation: Rank([Revenue] for [Product line])
And then add a filter to the report: Rank <= 10
In the filter definition, set the application to After auto aggregation.
You will get the top 10 revenue generated by product line based on the sales Rep.

Conditional formatting in Report Studio

Highlight data in a report to better identify exceptional results. For example, to identify sales representatives who have exceeded their quota, create a condition that checks if each representative's sales for the year is greater than their quota for the year. 

Steps:

1.Open the report that you want.

2.From the File menu, click Variables.
3.Create a variable by clicking the add button bellow the Variablesbox.
4.In the Name box, type a name for the variable.
5.In the Type box, select the type of variable you want to create:

To create a variable that has only two possible values, yes and no, click Boolean.
To create a variable whose values are string-based, click String.
6.Click OK.
7.Click the Edit button below the Expression box.
8.In the Expression Definition box, define the condition.
9.Click OK twice.
10.In the work area, click the column that you want to highlight based on the condition you just created.
11.Click the Condition Explorer button .
The Condition Explorer dialog box appears.
12.Click the variable you just created.
13.In the Properties pane, click the Conditional Style property.
14.In the Variable dialog box, click the Variable box.
15.Click the variable you want to assign to the object.
16.In the Values box, select the values you want the condition to support.
Tip: A default value exists for each variable you define, and it is always selected.
17.Open the Condition Explorer dialog box again, and click one of the possible values for the variable other than the default value.
For example, if you created a boolean variable, click the Yes value.
18.In the Properties pane, specify the formatting that you want to highlight the column with when the condition is satisfied.
For example, click the Border property to create a thicker border around the column.
19.Repeat steps 17 to 18 for other possible values defined for the variable.
20.Repeat steps 10 to 19 for other objects that you want to highlight.

Conditionally display a column in Report Studio based on User ID



  1. With the report open in Report Studio, click on Query Explorer and select the query to be conditionally displayed.
  2. Ensure the Toolbox tab is selected on the Insertable Objects pane, then drag and drop a new Data Item (called user) under the Facts column
  3. Set the expression of the new data item to: #sq($account.defaultName)#
  4. Click on the Conditional Explorer and select Variables
  5. Add a new Boolean variable (called user_name) with the expression: [User]='user_name'
  6. From Page Explorer, select the appropriate report page
  7. Highlight the data item in the column to be conditionally displayed
  8. From the Properties pane to the bottom right corner of Report Studio, locate General > Conditional Style
  9. Click on the Ellipses and select the conditional variable (user_name).
  10. From the Conditional Explorer, go to the Variable > user_name > Yes. [If a user logs in as user_name, the object being conditionally displayed is not visible].
  11. From the Properties pane, locate Box > Box Type then click on the down arrow and select None].
  12. Repeat step 7-11 for the column label.
  13. Double click on the conditional Explorer to unselect it.
  14. Save the report, log out and log on as user_name to test. When the column is hidden, it will not appear in HTML, Excel or PDF formats.

Create a report that will display one of three possible reports based on a prompt selection

1. create new report in Report Studio
2. add the objects to be displayed on the report, ie. lists, crosstabs, text items, etc. (you can add 3 list objects using 3 different queries for example or 3 crosstabs which uses only 1 query)
3. create a prompt page and add a prompt object, ie. value prompt (this can be a new query or just using static choices)
4. in the properties pane of the prompt object, add a parameter to associate with the prompt (eg. parameter=displayparam)
5. go to query explorer and add a data item object to your report query (if report has 3 list objects with 3 queries, the data item only need to be added to one of the queries)
6. set the expression for the data item object to refer to your parameter which was associated with the prompt (eg. expression definition for the data item = ?displayparam?)
7. go back to the report page
8. add a conditional block to the report
9. click on conditional block property and a small window will pop up
10. click on the "Variables" button
11. create a new variable (eg. variable=displayvar)
12. set the expression to read the parameter value passed from the prompt (eg. ParamDisplayValue("displayparam") ) and click OK
13. create values to use for the different report types (eg. report1, report2, report3) which should match the values passed by the prompt
14. on the properties pane of the conditional block, select the current block property (eg. report1)
15. drag objects that are to be displayed when user selects a report from the prompt page (eg. report1) into the conditional block, ie. drag the list object to be displayed when user selects report1 in the prompt page into the conditional block
16. change the current block (eg. report2) and repeat step 15
17. set the objects for the rest of the possible values for the variable in the conditional block
18. run the report

How to display a prompt conditionally based on a selection. made in another prompt on the same page in Cognos BI

Use a Conditional Block List to contain the prompt that you wish to display conditionally. In addition, place a re-prompt Prompt Button on the prompt page. Steps: These steps assume that you have already created your report and have defined your parameter filters. The filter for the optional prompt must have its Usage property set to Optional. To build the prompt page:
  1. Add a prompt page to your report
  2. In the File menu, click Variables.
  3. Create a variable of type Boolean.
  4. Add the following expression: ParamDisplayValue("Display_Option")= "Show"
  5. Add a table to the prompt page with the appropriate number of columns and rows for your needs.
  6. Add a prompt to one of the table cells.
  7. Select the parameter that this prompt resolves itself to.
  8. Add another prompt to the page, and set this prompt to resolve itself to the boolean variable created in step 3.
  9. Use the Static Choices property of the prompt to create values for it to display: Example: Use Display Show Show Hide Hide
  10. Add a Prompt Button to a cell on the table.
  11. Change the Type property of the Prompt Button to Re-prompt.
  12. Add a Conditional Block List to the one of the table cells
  13. Select the Conditional Block on the page.
  14. Set the Conditional Block property to the variable created in step 3.
  15. Set the Current Block property to Yes.
  16. Add the prompt that you wish to display conditionally to the Conditional Block object.
  17. Set the Current Block property to No. The Conditional Block appears empty.
  18. For the hidden prompt to display, select Show and click the Re-prompt button.
Using Auto-Submit attempts to submit the report. Ensure the auto submit properties of the prompts are set to No.

Content deployment in Cognos Environments

Keywords: Deploy, Deployment, Export, Import, Content Store

     Outside of a Proof of Concept, any environment where an application like Cognos is installed, it is wise to have at least two instances, one for development and one for production. In these cases you will have to deploy reports and other content from development to production and vice-versa.  There are multiple ways this can be done depending on your needs.

Deployment through the Cognos Portal: 
     This is the recommended and preferred method and works for all requirements. You will be using the deployment wizard to do this:
  • Login to your production environment and launch "IBM Cognos Administration" from Cognos Portal.
  • Click on "Configuration" tab and "Content Administration" in the left pane.
  • From the toolbar item, click "New Export"
  • Enter a name of the export and a description (optional) and click Next
  •  Next, select the desired deployment method: You can choose to export the entire content store or only selected folders or packages.
  • If you pick the entire content store, you can optionally include user account information to have the same security settings as in the production environment
  • In the next step, entire a name for the archive. This will be the file name when the export completes.
  • If you are exporting the entire content store, cognos requires you to encrypt the archive using a password. Enter a password:
  •  After this step, review the settings, save and run the export.
  • Check the activities in IBM Cognos Administration to make sure export runs and completes successfully.
  • Login to the production cognos server and navigate to: <cognos install directory>\deployment folder.
  • Find the zip file with the name you entered in the Export wizard.
  • Copy this file to the development environment.
  • Now login to the Development environment and navigate to Content Administration.
  • Create a "New Import" from the toolbar icon
  • Select the archive that you just copied over and click next.
  • Select the desired settings and click Finish.
  • Now your content from production environment will be imported.
  • Go to "Current Activities" in the "Status" tab of "IBM Cognos Administration" and make sure the import completes successfully.

Monday, May 2, 2016

Cognos Framework Manager Design Best Practices - 1

This proven design is based on using a data warehouse as the data source. 4 Layers are implemented as namespaces in Framework Manager as follows:

Database Layer:
A replica of the source database. Use the Metadata Import wizard to get tables into this namespace.
Do not meddle with the data source queries created by the import as this will adversely affect query performance for end users.
The other tasks that need to be done in this layer are:
a. Set usage correctly – “identity” for surrogate keys, “fact” for sumable numbers, otherwise set to “attribute”.
b. Create 1:N relationship from each dim to fact. I prefer to do this manually rather than allow the Metadata Import wizard to do it incorrectly. Only inner joins, not outer joins!!!
c. Add Determinants on dimensions only, no determines on facts. Top down approach – group by from the top down to unique for surrogate key at the bottom.

Modelling Layer:
Here we create queries that reference data source queries from the Database layer. At a minimum, create identical query subject in the Modelling layer for each data source query in the Database layer. You can also rename queries and its items to your hearts content. If you’ve got a well designed data warehouse as the data source you should not have to rename all the items. The one thing I do is take out the word “Dim” and “Fact” from the query subject names to make them more user friendly.
Relationships are duplicated/recreated in this layer from the Database layer. If sub dimensions or sub facts queries are created then additional relationships need to be added that do not exist in the Database layer.
Other tasks you can do in this layer
a. business calculations eg gross margin, gross margin %
b. amounts in standard currencies
c. folders inside query subjects to organise query items rather than just seeing a big long list of item
d. hide items eg surrogate keys
e. set default formats for numbers and dates

DMR Layer (Optional):
This is where we create multi-dimensional ROLAP cubes containing dimension hierarchies and measures.

Presentation Layer:
Contains star schema groups (right click on each fact in the Modelling layer and and each measures dimension in the Dimensional layer to create and cut and paste into this layer).
Optionally, create namespaces or folders to separate relational objects from dimensional objects. I like to create two namespaces, “Query” and “Analysis”. Query is for the SQL fact based star schema groups and Analysis is for the Dimensional star schema groups

Governor Settings in Cognos

Governor Settings in Cognos:

Governor settings are used to reduce system resource requirements and improve performance. You set governors before you create packages to ensure the metadata in the package contains the specified limits. All packages that are subsequently published will use the new settings. There are a number of governors that you can set. Governor settings in the model can be overridden by governor settings in Report Studio

For Example,

Report Table Limits - You can control the number of tables that a user can retrieve in a query or report

Data Retrieval Limits - You can control the number of rows that are returned in a query or report

Query Execution Time Limits - You can limit the time that a query can take 

Large Text Items Limit - You can control the character length of BLOBS (binary large objects) that a user can retrieve in a query or report

Allow Enhanced Model Portability at Run Time - You can use a separate but structurally similar data source at run time. The database schema must be the same between the two data sources.

Allows Usage of Local Cache - Select this governor to specify that all reports based on this model should use cached data.

Outer Joins - You can control whether outer joins can be used in your  query or report.

Cross-Product Joins - You can control whether cross-product joins can be used in your query or report.

Use With Clause When Generating SQL - You can choose to use the With clause with Cognos SQL if your data source supports the With clause.

Suppress Null Values for Dimensional Data Sources - This governor is supported for SAP BW data sources only. It does not work with relational or OLAP data sources.

Thursday, March 10, 2016

Challenges of Data Integration

Challenges of Data Integration

At first glance, the biggest challenge is the technical implementation of integrating data from disparate often incompatible sources. However, a much bigger challenge lies in the entirety of data integration. It has to include the following phases:

Design

  • The data integration initiative within a company must be an initiative of business, not IT. There should be a champion who understands the data assets of the enterprise and will be able to lead the discussion about the long-term data integration initiative in order to make it consistent, successful and benefitial.
  • Analysis of the requirements (BRS), i.e. why is the data integration being done, what are the objectives and deliverables. From what systems will the data be sourced? Is all the data available to fulfill the requirements? What are the business rules? What is the support model and SLA?
  • Analysis of the source systems, i.e. what are the options of extracting the data from the systems (update notification, incremental extracts, full extracts), what is the required/available frequency of the extracts? What is the quality of the data? Are the required data fields populated properly and consistently? Is the documentation available? What are the data volumes being processed? Who is the system owner?
  • Any other non-functional requirements such as data processing window, system response time, estimated number of (concurrent) users, data security policy, backup policy.
  • What is the support model for the new system? What are the SLA requirements?
  • And last but not least, who will be the owner of the system and what is the funding of the maintenance and upgrade expenses?
  • The results of the above steps need to be documented in form of SRS document, confirmed and signed-off by all parties which will be participating in the data integration project.

Implementation

Based on the BRS and SRS, a feasibility study should be performed to select the tools to implement the data integration system. Small companies and enterprises which are starting with data warehousing are faced with making a decision about the set of tools they will need to implement the solution. The larger enterprise or the enterprises which already have started other projects of data integration are in an easier position as they already have experience and can extend the existing system and exploit the existing knowledge to implement the system more effectively. There are cases, however, when using a new, better suited platform or technology makes a system more effective compared to staying with existing company standards. For example, finding a more suitable tool which provides better scaling for future growth/expansion, a solution that lowers the implementation/support cost, lowering the license costs, migrating the system to a new/modern platform, etc.

Testing

Along with the implementation, the proper testing is a must to ensure that the unified data are correct, complete and up-to-date.
Both technical IT and business needs to participate in the testing to ensure that the results are as expected/required. Therefore, the testing should incorporate at least Performance Stress test (PST), Technical Acceptance Testing (TAT) and User Acceptance Testing (UAT ) PST, TAT (Technical Acceptance Testing), UAT (User Acceptance Testing).

Data Integration Techniques

There are several organizational levels on which the integration can be performed. As we go down the level of automated integration increases.
Manual Integration or Common User Interface - users operate with all the relevant information accessing all the source systems or web page interface. No unified view of the data exists.
Application Based Integration - requires the particular applications to implement all the integration efforts. This approach is manageable only in case of very limited number of applications.
Middleware Data Integration - transfers the integration logic from particular applications to a new middleware layer. Although the integration logic is not implemented in the applications anymore, there is still a need for the applications to partially participate in the data integration.
Uniform Data Access or Virtual Integration - leaves data in the source systems and defines a set of views to provide and access the unified view to the customer across whole enterprise. For example, when a user accesses the customer information, the particular details of the customer are transparently acquired from the respective system. The main benefits of the virtual integration are nearly zero latency of the data updates propagation from the source system to the consolidated view, no need for separate store for the consolidated data. However, the drawbacks include limited possibility of data's history and version management, limitation to apply the method only to 'similar’ data sources (e.g. same type of database) and the fact that the access to the user data generates extra load on the source systems which may not have been designed to accommodate.
Common Data Storage or Physical Data Integration - usually means creating a new system which keeps a copy of the data from the source systems to store and manage it independently of the original system. The most well know example of this approach is called Data Warehouse (DW). The benefits comprise data version management, combining data from very different sources (mainframes, databases, flat files, etc.). The physical integration, however, requires a separate system to handle the vast volumes of data.

Courtesy :http://www.dataintegration.info/data-migration

Thursday, February 25, 2016

The 10 Essential Rules of Dimensional Modelling


Rule #1: Load detailed atomic data into dimensional structures.
Dimensional models should be populated with bedrock atomic details to support the unpredictable filtering and grouping required by business user queries. Users typically don’t need to see a single record at a time, but you can’t predict the somewhat arbitrary ways they’ll want to screen and roll up the details. If only summarized data is available, then you’ve already made assumptions about data usage patterns that will cause users to run into a brick wall when they want to dig deeper into the details. Of course, atomic details can be complemented by summary dimensional models that provide performance advantages for common queries of aggregated data, but business users cannot live on summary data alone; they need the gory details to answer their ever-changing questions.
Rule #2: Structure dimensional models around business processes.
Business processes are the activities performed by your organization; they represent measurement events, like taking an order or billing a customer. Business processes typically capture or generate unique performance metrics associated with each event. These metrics translate into facts, with each business process represented by a single atomic fact table. In addition to single process fact tables, consolidated fact tables are sometimes created that combine metrics from multiple processes into one fact table at a common level of detail. Again, consolidated fact tables are a complement to the detailed single-process fact tables, not a substitute for them.
Rule #3: Ensure that every fact table has an associated date dimension table.
The measurement events described in Rule #2 always have a date stamp of some variety associated with them, whether it’s a monthly balance snapshot or a monetary transfer captured to the hundredth of a second. Every fact table should have at least one foreign key to an associated date dimension table, whose grain is a single day, with calendar attributes and nonstandard characteristics about the measurement event date, such as the fiscal month and corporate holiday indicator. Sometimes multiple date foreign keys are represented in a fact table.
Rule #4: Ensure that all facts in a single fact table are at the same grain or level of detail.
There are three fundamental grains to categorize all fact tables: transactional, periodic snapshot, or accumulating snapshot. Regardless of its grain type, every measurement within a fact table must be at the exact same level of detail. When you mix facts representing multiple levels of granularity in the same fact table, you are setting yourself up for business user confusion and making the BI applications vulnerable to overstated or otherwise erroneous results.
Rule #5: Resolve many-to-many relationships in fact tables.
Since a fact table stores the results of a business process event, there’s inherently a many-to-many (M:M) relationship between its foreign keys, such as multiple products being sold in multiple stores on multiple days. These foreign key fields should never be null. Sometimes dimensions can take on multiple values for a single measurement event, such as the multiple diagnoses associated with a health care encounter or multiple customers with a bank account. In these cases, it’s unreasonable to resolve the many-valued dimensions directly in the fact table, as this would violate the natural grain of the measurement event. Thus, we use a many-to-many, dual-keyed bridge table in conjunction with the fact table.
Rule #6: Resolve many-to-one relationships in dimension tables.
Hierarchical, fixed-depth many-to-one (M:1) relationships between attributes are typically de-normalized or collapsed into a flattened dimension table. If you’ve spent most of your career designing entity-relationship models for transaction processing systems, you’ll need to resist your instinctive tendency to normalize or snowflake an M: 1 relationship into smaller sub dimensions; dimension de-normalization is the name of the game in dimensional modelling.
It is relatively common to have multiple M:1 relationships represented in a single dimension table. One-to-one relationships, like a unique product description associated with a product code, are also handled in a dimension table. Occasionally many-to-one relationships are resolved in the fact table, such as the case when the detailed dimension table has millions of rows and its roll-up attributes are frequently changing. However, using the fact table to resolve M:1 relationships should be done sparingly.
Rule #7: Store report labels and filter domain values in dimension tables.
The codes and, more importantly, associated decodes and descriptors used for labelling and query filtering should be captured in dimension tables. Avoid storing cryptic code fields or bulky descriptive fields in the fact table itself; likewise, don’t just store the code in the dimension table and assume that users don’t need descriptive decodes or that they’ll be handled in the BI application. If it’s a row/column label or pull-down menu filter, then it should be handled as a dimension attribute.
Though we stated in Rule #5 that fact table foreign keys should never be null, it’s also advisable to avoid nulls in the dimension tables’ attribute fields by replacing the null value with “NA” (not applicable) or another default value, determined by the data steward, to reduce user confusion if possible.
Rule #8: Make certain that dimension tables use a surrogate key.
Meaningless, sequentially assigned surrogate keys (except for the date dimension, where chronologically assigned and even more meaningful keys are acceptable) deliver a number of operational benefits, including smaller keys which mean smaller fact tables, smaller indexes, and improved performance. Surrogate keys are absolutely required if you’re tracking dimension attribute changes with a new dimension record for each profile change. Even if your business users don’t initially visualize the value of tracking attribute changes, using surrogates will make a downstream policy change less onerous. The surrogates also allow you to map multiple operational keys to a common profile, plus buffer you from unexpected operational activities, like the recycling of an obsolete product number or acquisition of another company with its own coding schemes.
Rule #9: Create conformed dimensions to integrate data across the enterprise.
Conformed dimensions (otherwise known as common, master, standard or reference dimensions) are essential for enterprise data warehousing. Managed once in the ETL system and then reused across multiple fact tables, conformed dimensions deliver consistent descriptive attributes across dimensional models and support the ability to drill across and integrate data from multiple business processes. The Enterprise Data Warehouse Bus Matrix is the key architecture blueprint for representing the organization’s core business processes and associated dimensionality. Reusing conformed dimensions ultimately shortens the time-to-market by eliminating redundant design and development efforts; however, conformed dimensions require a commitment and investment in data stewardship and governance, even if you don’t need everyone to agree on every dimension attribute to leverage conformity.
Rule #10: Continuously balance requirements and realities to deliver a DW/BI solution that’s accepted by business users and that supports their decision-making.

Dimensional modellers must constantly straddle business user requirements along with the underlying realities of the associated source data to deliver a design that can be implemented and that, more importantly, stands a reasonable chance of business adoption. The requirements-versus-realities balancing act is a fact of life for DW/BI practitioners, whether you’re focused on the dimensional model, project strategy, technical/ETL/BI architectures or deployment/maintenance plan.

Friday, November 19, 2010

cognos dictionary

drill down
The act of navigating from one level of data to a more detailed level. The levels are set by the
structure of the data.

drill up
The act of navigating from one level of data to a less detailed level. The levels are set by the
structure of the data.

package
A subset of a model, which can be the whole model, to be made available to the Cognos 8 server.

publish
To expose all or part of a Framework Manager model via a package to the Cognos 8 server, so
that Cognos BI Users can use it to create reports and other content.


query
A specification for a set of data to retrieve from a data source. A report specification can contain
one or more queries.
The type of object created and edited by Query Studio. A query is a subtype of report.

query item
A representation of a column of data in a data source. It contains a reference to a database
column, a reference to another query item, or a calculation. Query items may appear in a model or
in a report.


query subject
A query subject can be defined as a collection of references to items of other query subjects, or expressed as an SQL expression that represents selected query items. These query items will be retrieved from objects such as tables, synonyms,views, and so on. Query subjects contain query items.


report
A set of data deliberately laid out to communicate business information. Depending on the
context, "report" may refer to report specification or report output.



While designing package you must avoid ….
·         Outer joins à may lead to performance issues, generally not required for data warehouse.
·         Fact to fact table joins à queries take longer time to run and may lead to cross product           join/Cartesian product (wrong output).  Union of queries is preferred over fact to fact join.
While designing the reports you must avoid….
·         ReportNet Union à gives poor performance, instead implement it in underlying SQL in report itself.
·          Unnecessary joins à Do not include columns from dimension tables if it is present in fact table.  This improves report performance (e.g., if a fiscal year col. is available in fact table, then don’t use calendar dimension table)



How to hide Select All in cognos8

1)How to hide Select All | Deselect All for all prompts in the prompt page for 8.3:

 For this consider the following prompt page where the user hasto give the product prompt  as a f
<SCRIPT LANGUAGE="JavaScript">;
// hiding select All/deselect All in Cognos 8.3 form.
for(j=0;j<document.links.length;j++)
{
y=document.links[j];
if (y.id.indexOf("SELECT") != -1) document.getElementById(y.id).style.display='None';
}
</script>

2) To hide Select All | Deselect All for the second prompt only in a prompt page with two prompts for 8.3:
<SCRIPT LANGUAGE="JavaScript">
// hiding select All/deselect All in Cognos 8.3 form.
for(j=0;j<document.links.length;j++)
{
y=document.links[j];
if (j==2 || j==3)
{
if (y.id.indexOf("SELECT") != -1) document.getElementById(y.id).style.display='None';
}
}
</script>
Note: The values for the "j" variable for the if (j==2 || j==3) statement above represent the 3rd and 4th link in the two prompt multi-select prompt page. The first and second link would be referenced with a value of j=0 and j=1. 

How to remove row in a crosstab when a specific column (maybe nested) in the crosstab has the measure value of 0, using OLAP data source

Resolving the problem
1. In the Report Studio, under the relevant query, create a new Data Item
2. In the expression definition of this new data item, put:

aggregate(currentMeasure within set [Column Data Item])

3. Save this data item as [Aggregate(Column)]
4. Create a new data item, this time in the expression definition, put something like this:

filter([Row Data Item], tuple([Aggregate(Column)],[Measure]) > 0)
and save it as [New Item].

[Row Data Item] is the data item for the crosstab row. Should the author use actual members for the row, it is recommended to create another additional Data Item to contain a set() function, which in turn contains each individual member that the author chooses. Use this data item in the filter() function above, and then use [New Item] as the crosstab row.

Attached below are report specs using Great Outdoors Company in 8.3 for nested and normal columns.

How to apply zero-suppression to a list report

You need to create a calculated data item that is the total of all your numeric columns and create a filter that would compare against zero.
Steps:
1.     Create a calculated data item that totals all of your numeric columns that could have a zero value. This data item will not be be used in the report but will act as filter in the underlying query.
2.     Create a detailed filter in the query that compares the data item created in item 1 and compare it against a zero value. To display a row we are testing for a row is not equal to zero [calculatedsum] <> 0.
3.     Ensure that the application of the filter is done after aggregation.
Run the report. You should see that any rows that have all zeros in the value columns will not be displayed.