COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: gosoccer on 18 May 2017 12:53:46 PM

Title: _first_of_month () and getting Error (Relationla Model)
Post by: gosoccer on 18 May 2017 12:53:46 PM
Hi,
I'm trying to get all the rows that satisfies certain condition before the first of the month. So, basically, the below would provide me what I need but it's failing with an error. So, basically trying to get/show any rows that falls before the first of the month.
[Presentation View].[XXX].[S_DATE] <=_first_of_month ([Presentation View].[XXX].[S_DATE])

QE-DEF-0459 CCException
OP-ERR_0028 Unsupported conditional expression: 'expression = ....."

Pls help if you can.

Thanks so much.
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: gosoccer on 18 May 2017 01:54:47 PM
Would the following go back and filter all the cases from 99 days ago if it's in a Data Item above my Crosstab Edge?
(_add_days(_first_of_month(_add_months([UCM Presentation View].[XXX].[S_DATE],-100)),+1))

Thanks so much!
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: MFGF on 19 May 2017 03:51:13 AM
Quote from: gosoccer on 18 May 2017 12:53:46 PM
Hi,
I'm trying to get all the rows that satisfies certain condition before the first of the month. So, basically, the below would provide me what I need but it's failing with an error. So, basically trying to get/show any rows that falls before the first of the month.
[Presentation View].[XXX].[S_DATE] <=_first_of_month ([Presentation View].[XXX].[S_DATE])

QE-DEF-0459 CCException
OP-ERR_0028 Unsupported conditional expression: 'expression = ....."

Pls help if you can.

Thanks so much.

Hi,

Can you explain your logic here? That expression doesn't seem to make very much sense to me.

Let's substitute today's date into the expression to see what it would do:

19-May-2017 <= _first_of_month( 19-May-2017 )
which in turn gives us
19-May-2017 <= 01-May-2017

The only dates this would ever return a result for are the first days in any months, eg

01-May-2017 <= _first_of_month( 01-May-2017 )

but in that case, it could only ever be equal, not less than? Can you explain?

MF.
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: BigChris on 19 May 2017 04:19:07 AM
I think the second S_DATE should really be today's date
[Presentation View].[XXX].[S_DATE] <=_first_of_month (current_date)
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: gosoccer on 19 May 2017 06:26:54 AM
Thank you,

You right, Returns only one.

PLS see attached.

In the first column of the Crosstab, called Open Cars Sold suppose to shown the counts based on the begining of the month (First Day of each month), the report needs to show how many rows (Count of Rows) that are based on certain CODE such as (2,3,4).

That is what I'm trying to do.

Thanks for your time.
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: hespora on 19 May 2017 06:37:22 AM
the more logical approach for that filter would then be

extract(day,[Presentation View].[XXX].[S_DATE]) = 1

try and see if that works for you
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: gosoccer on 19 May 2017 06:48:59 AM
thx so much.
I''m getting the below error,
   Unsupported conditional expressions: 'expression="[__ns_0].[extract(day from UCM Presentation View_ST_DATE)_dim].[extract(day from UCM Presentation View_S_DATE)_dim].[level].[levelkey] = 1"'
No such why it's thinking it's DMR?

The model is Relational.
Thanks a lot :) :)
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: gosoccer on 19 May 2017 10:40:15 AM
Unfortunately, As I try creating a data item so I can drop it on top of the Top Edge of a Crosstab to get the
previous month data but it's failing.

[UCM Presentation View].[S_DATE] between _first_of_month(_add_months(current_date,-6)) and _last_of_month(_add_months(current_date,-6))

Getting the error,
   The 'fn:current_date' function is not supported in the context in which it is used.
Any ideas how I can get the Data Item created.

Thanks :) :)
Title: Re: _first_of_month () and getting Error (Relationla Model)
Post by: gosoccer on 19 May 2017 03:04:59 PM
Would you consider this as add (+) one day to the first of month that is going Back
11 Months from the S_DATE?  :) :)