Thursday, March 27, 2008

filter vs tuple

why should you use tuple() and not filters.

First of all
you can only use one filter... but you can write as many tuple expressions as you want.

e.g. Sales is a measure and you want to get its value on 1/1/2008 and 3/1/2008 
How would you do it with a filter? One would make the second impossible.
With tuple expressions you can create calculated data items and call them something like Sales_on_1/1/2008 and Sales_on_3/1/2008

tuple([Sales], [Time Dimension].[date hierarchy].[date]->[2008-01-01])

But I have an even better reason!

Cognos user interface does not distinguish between relational and dimensional or DMR model.
You should!
What does a filter mean when working with a dimensional model?
Who the hell knows.
I think with DMR they (Cognos) add a where clause to the generated SQL... so something will happen... it's just ugly. See how your higher level aggregates will behave...
using tuples() is way more clear!

TUPLE RULEZ!

good nite!

Friday, March 14, 2008

Macro functions - undocumented feature in Report Studio

Did you know that you can use the same macro functions that you have in Framework Manager in Report Studio?

It's not documented in the Report Studio users guide and the GUI which lists the available functions doesn't suggest it either.

Yet, they are there!

Try writing an expression where instead of ?Param1? you write #prompt('Param1')# ... there you go.

This lets you use some very powerful tricks when working with a dimensional model.
Some of which I'll describe later...

Wednesday, March 5, 2008

How do charts work like crosstabs

I found the graphical interface of charts rather challenging to capture but once you understand that they work exactly like crosstabs you can figure it out:

measure (y-axis) = Deafult Measure
Series = vertical axis
Category (x-axis) = horizontal axis

note that just like a crosstab axis can nest one dimension into another, or add measures on the axis you can do the same in the chart

example crosstab:
note the nesting of Revenue and Gross Profit under Retailer
and
Product type under Month(Time)


the corresponding chart:

note: we have the same nesting

















when we run the report the chart will look like this:

note: the two measures on the legend of the vertical axis

















note: the legend explains the color coding for each combination of retailer and revenue or retailer and profit













whether this complex chart makes sense is a good question... sometimes it does, sometimes it doesn't... the point is: you could if you wanted!

Tuesday, March 4, 2008

How to use prompt values in a tuple expression

This golden nugget can save you 2 days of work - that's how long it took me to figure out the syntax.

In the tuple() you can use a member to specify which value of the measure you want. This will work much like a filter... just better.

Lest say you have a Sales measure and a Time dimension with Date at the lowest level.

You can write something like this:

tuple([Sales], [Time Dimension].[Date hierarchy].[Date]->[all].[1/1/2008])

this will get you the Sales on 1st Jan. 2008

This is great, but you want to make this a parameter, so the user can specify the date.
Maybe you have a reporting interval called ?ReportStart? and ?ReportEnd? and you want to get the Sales on the last day of the reporting interval.

You can do this:

tuple([Sales], [Time Dimension].[Date hierarchy].[Date]->[all].#sb(prompt('ReportEnd','date'))#

You can use this expression in a crosstab or graph to give you the Sales measure on the end of the reporting interval.

In more generic terms this is the syntax to use prompt parameters in tuple() expressions.

Monday, March 3, 2008

Cognos UI

I found that Cognos uses the same user interface when working on dimensional (including DMR) and relational model.
This causes a lot of confusion because the two work totally different.
To further worsen things there is no error message when you do something that... you just should not do. Even worse... you get some results. But who know what those are!