Sunday, April 6, 2014

Create a crosstab report that calculates the difference between two rows


This is done using the running-difference function, with the appropriate parameters. You do this by adding a data-item to the query that uses the running-difference function. To ensure that it calculates the right values, you need to include the pivot-columns in the "For" clause. So, if you build a crosstab that shows "Year" accross the top, and "Country" and "City" down the side, with "Quantity" as the displayed measure, you would set our data item to use the following expression:

running-difference([Model].[QS].[Quantity] for [Country],[City])

This tells Cognos 8 to calculate the difference between the columns, but not to carry that difference over to the next row. It's important that the order of the data items in the "for" clause be in the same order as the groupings of the report. For more detail on the FOR clause, review "Using the AT and FOR Options with Relational Summary Functions" document

No comments:

Post a Comment