Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to divide two dates in rational insight report

 Actually i want to use schedule variance. My schedule variance formula is ((([Actual Finish Date]-[Actual Start Date])-([Planned_End_Date]-[Planned_Start_Date]))/([Planned_End_Date]-[Planned_Start_Date]))*100. 


I can subtract it but cannot divide it.
But it is showing error like 

 
    An error occurred while performing operation 'sqlPrepareWithOptions' status='-126'.
   
Details
UDA-SQL-0460 A general exception has occurred during local processing.UDA-EE-0094 The operation "equal" is invalid for the following combination of data types: "interval2" and "integer"RSV-SRV-0042 Trace back:RSReportService.cpp(717): QFException: CCL_CAUGHT: RSReportService::processImpl()RSReportServiceMethod.cpp(258): QFException: CCL_RETHROW: RSReportServiceMethod::process(): promptPagingForward_RequestRSASyncExecutionThread.cpp(848): QFException: RSASyncExecutionThread::checkExceptionRSASyncExecutionThread.cpp(305): QFException: CCL_CAUGHT: RSASyncExecutionThread::runImpl(): promptPagingForward_RequestRSASyncExecutionThread.cpp(904): QFException: CCL_RETHROW: RSASyncExecutionThread::processCommand(): promptPagingForward_RequestExecution/RSRenderExecution.cpp(587): QFException: CCL_RETHROW: RSRenderExecution::executeAssembly/RSDocAssemblyDispatch.cpp(323): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSLayoutAssembly.cpp(79): QFException: CCL_RETHROW: RSLayoutAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(417): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchChildrenAssemblyForwardAssembly/RSReportPagesAssembly.cpp(178): QFException: CCL_RETHROW: RSReportPagesAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(367): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSPageAssembly.cpp(314): QFException: CCL_RETHROW: RSPageAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(367): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSTableRowAssembly.cpp(177): QFException: CCL_RETHROW: RSTableRowAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(367): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSTableCellAssembly.cpp(151): QFException: CCL_RETHROW: RSTableCellAssembly::assembleAssembly/RSDocAssemblyDispatch.cpp(417): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchChildrenAssemblyForwardAssembly/RSDocAssemblyDispatch.cpp(367): QFException: CCL_RETHROW: RSDocAssemblyDispatch::dispatchAssemblyAssembly/RSAssembly.cpp(677): QFException: CCL_RETHROW: RSAssembly::createListIteratorAssembly/RSAssembly.cpp(732): QFException: CCL_RETHROW: RSAssembly::createListIteratorRSQueryMgr.cpp(519): QFException: CCL_RETHROW: RSQueryMgr::getListIteratorRSQueryMgr.cpp(586): QFException: CCL_RETHROW: RSQueryMgr::getResultSetIteratorRSQueryMgr.cpp(678): QFException: CCL_RETHROW: RSQueryMgr::createIteratorRSQueryMgrBasic.cpp(279): QFException: CCL_RETHROW: RSQueryMgrBasic::executeRsapiCommandRSQueryMgrBasic.cpp(269): QFException: CCL_RETHROW: RSQueryMgrBasic::executeRsapiCommandRSQueryMgrExecutionHandlerImpl.cpp(170): QFException: CCL_RETHROW: RSQueryMgrExecutionHandlerImpl::execute()RSQueryMgrExecutionHandlerImpl.cpp(162): QFException: CCL_RETHROW: RSQueryMgrExecutionHandlerImpl::execute()QFSSession.cpp(1153): QFException: CCL_RETHROW: QFSSession::ProcessDoRequest()QFSSession.cpp(1151): QFException: CCL_CAUGHT: QFSSession::ProcessDoRequest()QFSSession.cpp(1108): QFException: CCL_RETHROW: QFSSession::ProcessDoRequest()QFSSession.cpp(1084): QFException: CCL_RETHROW: QFSSession::ProcessDoRequest()QFSConnection.cpp(788): QFException: CCL_RETHROW: QFSConnection::ExecuteQFSQuery.cpp(213): QFException: CCL_RETHROW: QFSQuery::Execute v2CoordinationQFSQuery.cpp(4473): QFException: CCL_THROW: CoordinationPlanner

0 votes

Comments

Where in the model are these fields coming from?

Hi, 


Planned start & end date comes from Request timestamp extension query.Actual start date is activation date from request query. similarly actual finish date is resolved date from same request query

It is possible that ([Planned_End_Date]-[Planned_Start_Date]) results in zero or NULL for some records.  If it does then that may be the problem.  You should check for that in your data item expression.

The date in the Request timestamp extension table in the warehouse is datetime. It may not come through the model like that.  It is just defined as Value in the model.  One thing you could do is to create your own SQL query in the report to get the timestamp extension dates, and get all four dates in one query.  That would make it easier to tell what the different values are and then do the calculation in parts.  You would then join that to your Request query in the report Query section.  If you want examples of that let me know.



4 answers

Permanent link
Hi,

Have you tried to use DaysBetween Cognos formula ?

Another thing to try is divide the formula in multiplus data items instead of do the whole formula in just one data item and run the report as  tabular data each time that you create a new data iten to ensure that the data item created is working fine.

I third think to try is use CAST formula to cast your result to integer eg: cast(data_item1,integer).

Good Lucky

1 vote

Comments

 Hi,


I did not use daysbetween formula.
Between eg: cast(data_item1,integer).  for this may i have to cast each dataitem in that formula before ?


Permanent link
I recommend to you to separate each piece of your formula into data items to "debug" where the issue is happening. eg:

Your Data Item
(([Actual Finish Date]-[Actual Start Date])-([Planned_End_Date]-[Planned_Start_Date]))/([Planned_End_Date]-[Planned_Start_Date]))

Create:
Data Item 1
[Actual Finish Date]-[Actual Start Date]
Data Item 2
[Planned_End_Date]-[Planned_Start_Date]
Data Item 3
[Planned_End_Date]-[Planned_Start_Date]
Data Item 4
Data Item 1 - Data Item 2
Data Item 5
Data Item 4 / Data Item 3
Data Item 6
Data Item 5 * 100

Run as tabular data after create each data item and if necessary put CAST formula into Data Item 1, 2 and 3. eg: cast(([Actual Finish Date]-[Actual Start Date]),integer)

After found the issue and correct, you can put the formula again into just one data item.

This approach help a lot to find and solve problems in Cognos.

I hope this help you!

1 vote

Comments

I have also found this to be helpful in solving problems.  An additional thing I have found helpful is to add a filter to the query so that only one record is returned.  In some cases there is a record with unexpected values that is the cause of the problem, so getting the query to work on a single record first makes the problem easier to solve.

1 vote


Permanent link
This looks like expected- Date Time and Percentage (the result of the formula) are not compatible...

0 votes


Permanent link
Hi,
There are OOTB reports for schedule variance at     
Public Folders ‎> Sample Report Definitions ‎> Insight ‎> Data Warehouse Reports,
named "Iteration Variance Details" and "Project Variance Details". In this report, the formula is simpler, such as
Actual schedule variance = (Actual finish date - Planned finish date) * 100 / Planned duration

Perhaps you can review these OOTB report templates, and customize based on them.

0 votes

Comments

 But for this report, when i run, it is not displaying any data. Like for using that formula they pulled actual duration,planned duration metrics, I want the path of those metrics

 (Actual finish date - Planned finish date) * 100  upto this it is working after that putting / causes problem and from where i can get planned duration

As discussed, I think you need to create a sub query like (Actual finish date - Planned finish date) * 100 / Query2. Query2 = ([Planned_End_Date]-[Planned_Start_Date]). See the OOTB report "Project Variance Details" how it is implemented.

If problem persists, please raise a new PMR to discuss with IBM support team.

Or, Query 2 (Planned duration) can be zero, so that's why it cannot be calculated. If so, you need to find out why the data is not retrieved from RTC.

Or, Query 2 (Planned duration) can be zero, so that's why it cannot be calculated. If so, you need to find out why the data is not retrieved from RTC.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Dec 21 '16, 2:06 a.m.

Question was seen: 2,563 times

Last updated: Dec 23 '16, 11:28 a.m.

Confirmation Cancel Confirm