If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

How to obtain the Last Day of the Month in Relational Model

Started by gosoccer, 09 Feb 2017 03:27:31 AM

Previous topic - Next topic

gosoccer

Hi,
I'm trying to get the Last Day of the month using the below but getting an error.

If ([Physical View].[ANALYSIS].[TYPE_CD] ='1' and _last_of_month ([Physical View].[ANALYSIS].[Process_Date])) THEN
(1)
else
(0)
But getting an error saying, "Syntax error near ")""
Please help  if you can.

Thanks for your time. :) :)

Lynn

Quote from: gosoccer on 09 Feb 2017 03:27:31 AM
Hi,
I'm trying to get the Last Day of the month using the below but getting an error.

If ([Physical View].[ANALYSIS].[TYPE_CD] ='1' and _last_of_month ([Physical View].[ANALYSIS].[Process_Date])) THEN
(1)
else
(0)
But getting an error saying, "Syntax error near ")""
Please help  if you can.

Thanks for your time. :) :)


Your expression for the _last_of_month() function is correct, but you aren't comparing it to anything. If you consider what gets returned, your statement says something like this:


if ( TYPE_CD = '1' and 2017-02-28 )
then
(1)
else
(0)


You'd need to compare _last_of_month ( [Process_Date] ) with some other date value. Perhaps current_date? If so, try this:


If ( [Physical View].[ANALYSIS].[TYPE_CD] ='1' and _last_of_month( [Physical View].[ANALYSIS].[Process_Date] ) = current_date ) THEN
(1)
else
(0)


gosoccer

Ahh! Yes Lynn, that worked. Thx so much! It's 5 Am over here. I'm so glad I got an answer. Couldn't sleep.  :) :)