COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Cognos_Jan2017 on 29 Mar 2017 03:50:20 PM

Title: Trying to Write a Maximum (Most Recent Entry) for a Location
Post by: Cognos_Jan2017 on 29 Mar 2017 03:50:20 PM
The code is ...
maximum ([IIMS - Business Layer].[General Incident Details].[Date Of Incident]) for [IIMS - Business Layer].[General Incident Details].[Incident Location]

... which gets a parsing error at or near position 84, which is, marked by X preceding 84 ...
X[IIMS - Business Layer].[General Incident Details].[Incident Location]

What am I doing wrong ... still new to Cognos.

TIA, Bob
Title: Re: Trying to Write a Maximum (Most Recent Entry) for a Location
Post by: New_Guy on 29 Mar 2017 03:55:13 PM
Hi,
I dont think you need a ')' bolded, in the middle and it should be at the end.
maximum ([IIMS - Business Layer].[General Incident Details].[Date Of Incident]) for [IIMS - Business Layer].[General Incident Details].[Incident Location])
Good luck
New guy
Title: Re: Trying to Write a Maximum (Most Recent Entry) for a Location
Post by: Cognos_Jan2017 on 29 Mar 2017 04:18:41 PM
That was it !!!  THANK you New_Guy.

Now, a new problem.

How do I see ONLY the Maximum [Date of Incident]
record for each [Incident Location]?

Run those two Fields only?  Then another Query Calculation
to check Current_Date - the Maximum [Date of Incident]?

... Will try after sending this.

I ran Microsoft Access Aggregate queries a long time, but am
adjusting to doing the same in Cognos.

TIA, Bob
Title: Re: Trying to Write a Maximum (Most Recent Entry) for a Location
Post by: Cognos_Jan2017 on 29 Mar 2017 04:26:22 PM
That didn't work ...
How do I see ONLY the Maximum [Date of Incident]
record for each [Incident Location]?

Run those two Fields only?  Then another Query Calculation
to check Current_Date - the Maximum [Date of Incident]?

======================================================
It still shows any records for that Location that aren't the Maximum (most recent date).
We need to see ONLY the most recent (Maximum) [Date of Incident] record to calculate
how long ago that occurred.  Then take those values to assign to dated intervals as a
crosstab column.

TIA, Bob
Title: Re: Trying to Write a Maximum (Most Recent Entry) for a Location
Post by: New_Guy on 29 Mar 2017 04:29:54 PM
Hi,
Create a  filter [Date of Incident] = maximum([Date of Incident] for column1, column2).
Let us know if you face any issue.
Good luck
New guy
Title: Re: Trying to Write a Maximum (Most Recent Entry) for a Location
Post by: Cognos_Jan2017 on 29 Mar 2017 04:51:49 PM
Your ...
[Date of Incident] = maximum([Date of Incident] for column1, column2)

I tried as ...
[Date of Incident] = maximum([Date of Incident] for [Incident Location], [Date of Incident])

It didn't like that.

TIA, Bob
Title: Re: Trying to Write a Maximum (Most Recent Entry) for a Location
Post by: Cognos_Jan2017 on 06 Apr 2017 04:23:39 PM
I resolved this ...

A Summary Filter of ...
[Date Of Incident] = Maximum([Date Of Incident] For [Incident Location])
... works.