COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: locus on 08 May 2014 05:28:13 AM

Title: RESOLVED: Interval calculation using the same date field
Post by: locus on 08 May 2014 05:28:13 AM
Hi Folks,

I have a report with a single table [EVENTS] using the same date field but with differing filter criteria.

[ACTUAL DATE] filtering on [EVENT CODE]

The goal is to calculate the interval of [ACTUAL DATE] between two differing event codes.
So as follows:

CALC 1: CASE WHEN([EVENT_D].[EVENT_CODE] = 'SR191') THEN ([EVENT_D].[ACTUAL_DATE]) ELSE NULL END
CALC 2: CASE WHEN([EVENT_D].[EVENT_CODE] = 'SR192') THEN ([EVENT_D].[ACTUAL_DATE]) ELSE NULL END

INTERVAL CALC = CALC1 - CALC2

The report splits the two dates onto separate lines in RS, and no result is returned for the interval.

Is there a way to bring back both CALC1 & CALC2 to the same row?
Or at least achieve a result for the interval? (The two dates do not need to be on the report, only the interval is required.

Even in Framework Manager, the interval calc has no result.

Much appreciated,
Locus
Title: Re: Interval calculation using the same date field
Post by: Lynn on 08 May 2014 07:33:01 AM
Try setting the aggregation method on each of your calc columns to maximum.
Title: Re: Interval calculation using the same date field
Post by: locus on 08 May 2014 07:47:26 AM
Aaargh! So simple! :o

Thanks Lynn  :D Works great
Title: Re: RESOLVED: Interval calculation using the same date field
Post by: Lynn on 08 May 2014 07:53:42 AM
Yay! It is always easier once you know the answer  ;D