COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: norakmal.hakim on 09 May 2016 04:43:25 AM

Title: Increment over previous day data
Post by: norakmal.hakim on 09 May 2016 04:43:25 AM
Hi!

I was wondering how to do this:

Date                 |   Page Views for the day  | Percentage Difference from previous day

1 May 2016              1000                   
2 May 2016              1500                                                        50%
3 May 2016              1750                                                     16.66%
4 May 2016              1400                                                      - 20%

etc. so on so forth
...

How do i define the last column to be as such?
Title: Re: Increment over previous day data
Post by: Lynn on 09 May 2016 04:52:42 AM
If you have a relational source then take a look at the running-difference function.
Title: Re: Increment over previous day data
Post by: norakmal.hakim on 09 May 2016 05:29:35 AM
Quote from: Lynn on 09 May 2016 04:52:42 AM
If you have a relational source then take a look at the running-difference function.

Thanks for the reply! I know how to achieve this if I were to divide with current day page view but if let's say I want to divide by the previous day page view, how do I do that?

i.e. the formula is as such:

((Current Day Page View - Previous Day Page View) / Previous Day Page View ) *100

The numerator I can achieve it using the running difference function, how do I get the previous day page view to divide?
Title: Re: Increment over previous day data
Post by: Lynn on 09 May 2016 06:14:29 AM
The page views on the current row minus the running difference is the prior day amount.

May 2 - running diff = May 1
1500 - 500 = 1000

May 3 - running diff = May 2
1750 - 250 = 1500

I think your percentage calculation should be:

[Your running-difference calc] / ( [Page Views] - [Your running-difference calc] )

So on May 2 it would be 500 / ( 1500 - 500 ) = .5

Set the data format to percentage and you're good to go.
Title: Re: Increment over previous day data
Post by: norakmal.hakim on 09 May 2016 06:21:26 AM
Ah that works perfectly. Thanks!

Quote from: norakmal.hakim on 09 May 2016 05:29:35 AM
Thanks for the reply! I know how to achieve this if I were to divide with current day page view but if let's say I want to divide by the previous day page view, how do I do that?

i.e. the formula is as such:

((Current Day Page View - Previous Day Page View) / Previous Day Page View ) *100

The numerator I can achieve it using the running difference function, how do I get the previous day page view to divide?