COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: EArumugam on 03 Sep 2009 06:36:48 AM

Title: LEAD/ LAG Functions
Post by: EArumugam on 03 Sep 2009 06:36:48 AM
HI ALL,

How can i achieve the below example using LEAD/LAG function in FM or RS.


Actual Table looks like..

Name date             amount
AAA   01/01/09       1000
AAA    01/02/09       750
AAA    01/03/09       650
AAA    01/04/09        350

i need to add a query subject in FM like 'Difference amount', after that it shud be display as below


Name date             amount  Difference amount
AAA   01/01/09       1000         250(1000-750)
AAA    01/02/09       750          100(750-650)
AAA    01/03/09       650           300(650-350)
AAA    01/04/09        350         350 (same as amount bocs last line)

i acheive above using SQL in oracle.
but i donknow how implement in FM .

Title: Re: LEAD/ LAG Functions
Post by: gskumar on 03 Sep 2009 06:48:44 AM
Hi,
        IT is query item, so you need to add caluclation and apply the logic what you got in sql.
Cheers,
Sirish
Title: Re: LEAD/ LAG Functions
Post by: EArumugam on 03 Sep 2009 06:58:23 AM
i am getting the following error while applying the same logic..

QE-DEF-0478 Invalid coercion from 'measure' to 'member'