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

Using ?parameter? in lag function

Started by fml55555, 12 May 2014 02:56:24 PM

Previous topic - Next topic

fml55555

Is it possible to use a parameter instead of a member in expressions such as

Lag(member,integer)

I am using a macro (inside a dataitem) to get the month and year (format 04/2014) and want to use the input parameter to populate the same member for last year (such as 04/2013). I tried using the lag (?parameter?,12) but it gives me an error 'data type such as member expected'. I tried using the following methods which did not work

1. physically nesting the dataitem1 (which contains the macro) in another dataitem2 and using that data item in lag function

e.g. lag(dataitem2, 12)

2. Tried to create a member of the dataitem using the calculated member expression

   member(dataitem1,'abc','hierarchy of the month field')

Both have failed with error messages. What am I doing wrong, can someone guide me please?

Environment : Using SAP BW as data source (OLAP in FM)

MFGF

Quote from: fml55555 on 12 May 2014 02:56:24 PM
Both have failed with error messages. What am I doing wrong, can someone guide me please?

...and the error messages are?...

The lag function requires a member. What type of object does your macro resolve to? A member? An attribute? A caption? A level?

if you use an expression such as [month level from your hierarchy] -> ?yourParameter? to bring in a prompted month member then you can use the lag() function around this expression with no issues.

Cheers!

MF.
Meep!

fml55555

Hi there MFGF,

Thanks for coming to my rescue once again  :)!

Inside the macro, I have used the datatype as member unique name. The macro produces a prompt  (drop down) where one can select month/year (04/2004, 04/2005 and so on). The month/year is a member.

this is what I have been doing

lag(#prompt('Month-Year','memberuniquename','','set(','[Cube].[Dimension].[hierarchy].[level]',')')#,10)

this gives me the error (attached)



CognosPaul

lag will only take members, but your macro is resolving to a set.
Try instead:

lag(#prompt('Month-Year','memberuniquename','','','[Cube].[Dimension].[hierarchy].[level]','')#,10)

fml55555

Paul, MFGF...U guys are stars!! Thank you so much for all your help!!!