COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognos05 on 27 Jan 2015 10:00:29 PM

Title: MUN Error -breaking reports
Post by: cognos05 on 27 Jan 2015 10:00:29 PM
Hi,

I was using the below code for dynamically select the month member..Suddenly from yesterday it gives me the last of month for january as 30 instead of 31..

#promptmany('PrmMonth','mun','[Sales].[Time Period].[Time Period].[Months]->:[PC].[@MEMBER].[' + timestampMask(_first_of_month($current_timestamp),'yyyymmdd')+ '-' + timestampMask(_last_of_month($current_timestamp),'yyyymmdd') + ']'
,'set(','',')')#


Error :Member [20150101-20150130] doesnot exist

_last_of_month is giving 20150130 instead of 20150131.

Please suggest me an alternate code to get the last day of month as 20150131.I have to fix my reports which selects default month using this macro.

You can execute last of month and check if you still get 30. I am not sure with whom the bug is either the macro or current timestamp.

Thanks,
Nithya

Title: Re: MUN Error -breaking reports
Post by: MFGF on 28 Jan 2015 06:23:12 AM
Quote from: nithya1224 on 27 Jan 2015 10:00:29 PM
Hi,

I was using the below code for dynamically select the month member..Suddenly from yesterday it gives me the last of month for january as 30 instead of 31..

#promptmany('PrmMonth','mun','[Sales].[Time Period].[Time Period].[Months]->:[PC].[@MEMBER].[' + timestampMask(_first_of_month($current_timestamp),'yyyymmdd')+ '-' + timestampMask(_last_of_month($current_timestamp),'yyyymmdd') + ']'
,'set(','',')')#


Error :Member [20150101-20150130] doesnot exist

_last_of_month is giving 20150130 instead of 20150131.

Please suggest me an alternate code to get the last day of month as 20150131.I have to fix my reports which selects default month using this macro.

You can execute last of month and check if you still get 30. I am not sure with whom the bug is either the macro or current timestamp.

Thanks,
Nithya

What debugging have you tried? If you're not sure whether the issue is with your macro or with the value in current_timestamp, why wouldn't you build a test report to find out? It's not an obvious thing where someone can say "you did this wrong" since the syntax has been working fine for a while.

What is current_timestamp returning currently? The only person on Cognoise who can find out in your Cognos instance is you. We will help if we can, but you're going to have to do some investigation work to see what's going on.

Cheers!

MF.
Title: Re: MUN Error -breaking reports
Post by: cognos05 on 28 Jan 2015 07:51:41 AM
I tried _last_of_month($current_timestamp),'yyyymmdd')

Executing above statement and it returned 20150130 instead of 20150131.

Current timestamp gave me the current date.

So Yesterday night  I changed all my reports to select a default member instead of Dynamic member,

but now I get the value as 20150131 . I seriously dont understand what had happened,

Thanks,
Nithya
Title: Re: MUN Error -breaking reports
Post by: MFGF on 28 Jan 2015 08:13:17 AM
Quote from: nithya1224 on 28 Jan 2015 07:51:41 AM
I tried _last_of_month($current_timestamp),'yyyymmdd')

Executing above statement and it returned 20150130 instead of 20150131.

Current timestamp gave me the current date.

So Yesterday night  I changed all my reports to select a default member instead of Dynamic member,

but now I get the value as 20150131 . I seriously dont understand what had happened,

Thanks,
Nithya

So it has gone back to working ok today? That's very strange. I have no clue why this might be happening.

MF.
Title: Re: MUN Error -breaking reports
Post by: cognos05 on 28 Jan 2015 08:21:55 AM
But if its a bug with last of month, then should i use a different function to get the value, I don want this to happen again.May be I will check on this for few days.
Title: Re: MUN Error -breaking reports
Post by: cognos05 on 09 Feb 2016 09:27:45 PM
Hi All,

This bug has started again, when I open the report through vpn from home ,I get this error.

But when the same is opened from office i dont have any issues.
_last_of_month($current_timestamp),'yyyymmdd')   giving 28 for feb instead of 29.

I ran it at 10:52pm on feb 9 th
currenttimestamp values is showing correct -2016-02-09 22:52:19.292000000
last of month - value is showing 2016-02-28 22:52:19.292000000
but it should give me 2016-02-29 right,
[20160201-20160228] does not exist.

#'[1SaleCube].[Months].[Months].[Month]->:[PC].[@MEMBER].['+timestampMask(_first_of_month($current_timestamp),'yyyymmdd')+ '-' + timestampMask(_last_of_month($current_timestamp),'yyyymmdd') + ']'#


But working in office.  Not able to guess ,but think its because of vpn connection or something

SO whenever I use the member in the layout it throws me the error.

Is there any alternate for Lastofmonth

Thanks,
Nithya
Title: Re: MUN Error -breaking reports
Post by: BigChris on 10 Feb 2016 02:24:25 AM
When you look at the SQL for your query you should see something that looks something like this:

DATEADD( DAY, -1, DATEADD( MONTH, 1, DATEADD( DAY, -DAY( convert(datetime, convert( char(8),
current_timestamp, 112 ), 112) ) + 1, convert(datetime, convert( char(8), current_timestamp, 112 ), 112) ) ) ) AS "End_of_Month"


Can you check that you're getting the same statement both in your office and over your VPN?