COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: HelloCognos on 20 Aug 2018 01:13:51 PM

Title: Creating a Data Item to Show Days Between Two Dates ONLY If Within Last Year
Post by: HelloCognos on 20 Aug 2018 01:13:51 PM
Hi folks, This is a Relational Framework Request for help! Cognos 11 Analytics

I have come up with a Data Item that does the below but the below is returning (0) unfortunately.

If [report_date] >= _add_days (?Prompt Date?,-365)) then
(_days_between][report_date], [closed_date])
else
(0)

So all I need to do to return the days between if [closed_date] falls within the last 365 days but
in a Data Item within the same Query that may have the same for going back Two Years, etc..

Pls help if you can.

Thanks
Title: Re: Creating a Data Item to Show Days Between Two Dates ONLY If Within Last Year
Post by: Robl on 22 Aug 2018 05:46:18 AM
The code looks fine to me.

Try filtering the data to only have rows that have a closed date in the last year.
Then build up the calculation one step at a time to make sure each clause is working correctly.

Also, obviously, remember to check the aggregation/roll-up types on the finished data item.