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!

10 comments:

  1. Interesting post which reflects our experience with MDX and detail filters. That is they are bad in most circumstances except for zero suppression.
    Given that you can create a custom expression using tuple() to iterate over an axis not displayed in the report, when should you use tuple() function and when should you use a Cognos context filter?

    ReplyDelete
    Replies
    1. You use a tuple() inside a filter() to narrow down the context for the filter. You can also use a tuple() to explicitly override the context of a calculation, eg: the crosstab displays individual product lines in its rows while the percent of base calculation must reference these and also include a total of all product lines in its divisor.

      Delete
  2. Hi,

    Wondering if you have had any experience with tuple performance. Cognos Support has looked at our reports and identified tuples as a possible performance issue. I'm skeptical.

    Is there any right/wrong way to do a tuple?

    Are there any workarounds if you do not want to use a tuple?

    ReplyDelete
  3. what is the opposite of a tuple? for instance, i'm trying to: tuple([sales],[dept],NOT[project])

    ReplyDelete
    Replies
    1. Your statement looks like you're trying to return a value for the intersection of sales, dept without the values for project. What's not clear is whether these members are from from the same or different dimensions.

      Delete
  4. Hi, what do you mean by "NOT[project]" ?

    ReplyDelete
  5. How will you achieve with a tuple:
    Sales between a range of dates: Sales between 1-jan and 15-feb.
    Or...
    How can you filter with a tuple a set of member.
    Sales for jan and march

    ReplyDelete
  6. Hi! Great blog! I would like to know if someone knows the solution for David's Question. I need to filter for example, sales between a range of dates (or ages, or whatever). The problem there is using something to filter a range. Any idea? Thank you very much and great blog!

    ReplyDelete
  7. Hi Bernardo,

    you need to create a member set with all the members you want from the range....

    ReplyDelete