COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Invisi on 10 Nov 2016 02:22:54 AM

Title: first periods of moving-total
Post by: Invisi on 10 Nov 2016 02:22:54 AM
I am using the function moving-total to show a trend on that with a line chart based on twelve months. Because of the nature of the function, the first periods it is still accumulating the total. This means that the line is just going up for the first eleven data points. I remember to have seen there is a way to go around this, but I can't find it. Who has the way to show the full moving total from the first data point?
Title: Re: first periods of moving-total
Post by: BigChris on 10 Nov 2016 02:53:51 AM
It's not very clear what you need, but it's probably something along the lines of running-total([YourDataField] for [Period])
Title: Re: first periods of moving-total
Post by: hespora on 10 Nov 2016 03:53:33 AM
You need a two-step approach.

First query: Your measure per month. This query is filtered on your reporting period *plus* 11 months prior (personally, I find it easier actually to add a full prior year). In here, you build your moving total.
Second query: Based on Query1 rather than your data source, and in here you filter for your actual reporting period. Pass through month and moving total.
Title: Re: first periods of moving-total
Post by: Invisi on 10 Nov 2016 06:44:48 AM
hespora, that's what I look for, thanks!

Do you know how much impact on performance it has to use the second query based on the first?
Title: Re: first periods of moving-total
Post by: hespora on 10 Nov 2016 07:18:58 AM
From the experience on my org's systems: Next to no impact on performance.
Title: Re: first periods of moving-total
Post by: Invisi on 16 Nov 2016 07:53:43 AM
Thanks again!