COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: gosoccer on 15 Jun 2016 08:28:39 AM

Title: GROUPING IS NOT WORKING CORRECTLY (Report Studio 10.2)
Post by: gosoccer on 15 Jun 2016 08:28:39 AM
Hi, :)

For some reason, the Report is grouping the Date based on Date and Time instead of only Date. So, by each hour, it's grouping
the data. Is there a Format Setting that can be used in the Report or Framework Model to read the Dates as just Date so the
grouping does it's work based on just date.

Thanks a lot for your time!


Title: Re: GROUPING IS NOT WORKING CORRECTLY (Report Studio 10.2)
Post by: Lynn on 15 Jun 2016 08:37:10 AM
What is the data type for the field upon which the grouping is based? If it is a date with timestamp you can cast it in the report to a date datatype. If it is a string of some sort you'll need to provide more details about how the data in the field is formatted.
Title: Re: GROUPING IS NOT WORKING CORRECTLY (Report Studio 10.2)
Post by: gosoccer on 15 Jun 2016 08:46:39 AM
Hi Lynn and good morning,

yes, the data type is Timestamp. Would  you mind explaining further or share the cast statement.
So, I would create a calculated item in Report Studio and use something like below but not to character.
The below sentence is for converting to Character. Since it's date already, what could be the code?

For Character Conversion:

cast(Year([DateField]),char(4)) + '-' + cast(month([DateField]),char(2)) + '-' + cast(day([DateField]),char(2))

Since it's date already, what could be the code?

Thx so much.
Title: Re: GROUPING IS NOT WORKING CORRECTLY (Report Studio 10.2)
Post by: MFGF on 15 Jun 2016 08:50:22 AM
Quote from: gosoccer on 15 Jun 2016 08:28:39 AM
Hi, :)

For some reason, the Report is grouping the Date based on Date and Time instead of only Date. So, by each hour, it's grouping
the data. Is there a Format Setting that can be used in the Report or Framework Model to read the Dates as just Date so the
grouping does it's work based on just date.

Thanks a lot for your time!

Grouping is not working correctly? I'm willing to bet grouping is working exactly as it should. Grouping works based on identical values, and if your dates each have different time parts, they are not identical. What I think you mean is that grouping is not working the way you would like it to work?

Assuming you have dates with time parts in your data, you're going to need to cast them as dates before you group ie cast([your date-time item], date)

Cheers!

MF.
Title: RESOLVED Re: GROUPING IS NOT WORKING CORRECTLY (Report Studio 10.2)
Post by: gosoccer on 15 Jun 2016 08:56:52 AM
Excellent! Thx so much you guys! This works!!!!  :) :) :)
Title: Re: GROUPING IS NOT WORKING CORRECTLY (Report Studio 10.2)
Post by: Lynn on 15 Jun 2016 09:05:56 AM
Are you familiar with the "tips" section in the expression editor? There is often a decent explanation of the function and some examples as well. The tips for the cast function actually include a sentence that explains quite clearly what you needed.


QuoteWhen you convert a value of type timestamp to type date, the time portion of the timestamp value is ignored.
Title: Re: GROUPING IS NOT WORKING CORRECTLY (Report Studio 10.2)
Post by: gosoccer on 15 Jun 2016 09:11:48 AM
AHH!! Ok, I'll use that in the future! Thx again!