COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: barrysaab on 16 Mar 2012 11:02:48 PM

Title: Cumulative Sales
Post by: barrysaab on 16 Mar 2012 11:02:48 PM
I need to show cumulative sales for certain product type.I wrote following expression it is giving error:


Running-total ([Order Item Details].[Order Item Details].[Net Sale Item Qty] for (case when [Order Item Details].[Application].[Platform Name] ='ABC' then
[Order Item Details].[Order Item Details].[Net Sale Item Qty]
else
null)
end
)

and if i need to show monthly,quaterly,yearly cumulative sales separately,how this case statement should be written
Appreciate your help
Title: Re: Cumulative Sales
Post by: barrysaab on 17 Mar 2012 12:32:55 AM
I wrote this expression for week up to yesterday

if ([Order Item Details].[Order Source].[Order Source]='GHJ'
and [Order Item Details].[Application].[Platform Name]='ABC'
and ([Order Item Details].[Activity Date].[Short Date] between _add_days (current_date,-7) and _add_days(current_date,-1)))
then
(running-total([Order Item Details].[Order Item Details].[Net Sale Amt (USD)]))
else
(0)

But it is giving incorrect results.Thanks
Title: Re: Cumulative Sales
Post by: blom0344 on 18 Mar 2012 03:24:02 PM
What happens when you apply the running-total over the entire If.. then.. else.. statement?
Title: Re: Cumulative Sales
Post by: barrysaab on 18 Mar 2012 11:30:54 PM
The expression is validated but values i am getting are incorrect.Thanks
Title: Re: Cumulative Sales
Post by: blom0344 on 19 Mar 2012 01:58:32 AM
Any chance you can put the logic in a filter instead of in the case.  Running aggregates are computed on the server AFTER fetching the data-set, which in your case may be the cause of misaligned data
Title: Re: Cumulative Sales
Post by: barrysaab on 19 Mar 2012 02:50:25 AM
I think this logic woudn't work in filter as read somewhere this should be avoided in filters,moreover,i need to show this running total column in report.Thanks
Title: Re: Cumulative Sales
Post by: blom0344 on 19 Mar 2012 04:54:01 AM
I do not mean putting the if then else and running-total in a filter  :o

Make sure you use a filter to create the proper dataset (ordering is relevant too) before the running-total is done by the server
Title: Re: Cumulative Sales
Post by: barrysaab on 19 Mar 2012 10:16:20 AM
Finally,Two Data Items  and my First Data Item Expression :

if ([Order Item Details].[Order Source].[Order Source]='iTunes')and ([Order Item Details].[Activity Date].[Short Date] between _add_days (current_date,-7) and _add_days(current_date,-1)))
then
([Order Item Details].[Order Item Details].[Net Sale Amt (USD)]) else(0)

And the second Data Item Expression :


running -total(if ([Order Item Details].[Application].[Platform Name]='iPad' )) then (First Data item) else (0)

I am not sure whether it is right.Thanks