COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognovice on 28 Sep 2015 07:52:08 PM

Title: How to display sales value for previous day in a list report
Post by: cognovice on 28 Sep 2015 07:52:08 PM
I want to display a column in the list report that shows the sales value only for yesterday (previous day).  I have "value" as a sales fact within my package.  I also have sales invoice date as a date field.
Title: Re: How to display sales value for previous day in a list report
Post by: cognovice on 28 Sep 2015 08:03:07 PM
Sorry,  I want to add more.  I can put a filter something like invoice date = _add_days(current_date, -1) but I want this filter applied only to the value column as I also have other columns to display such as Value Month To Date and Value Year To Date.
Title: Re: How to display sales value for previous day in a list report
Post by: cognostechie on 28 Sep 2015 08:09:04 PM
Just ask the business to stop selling anything from today and simply delete all sales data prior to yesterday.  ;)


Actually, you are on the right track. Just apply that condition to the column and not to the query.

If ( [Date Column name]  = _add_days( current_date, -1  ) ) then (  [Sales value column name]    ) else (0)


Title: Re: How to display sales value for previous day in a list report
Post by: cognovice on 28 Sep 2015 08:24:58 PM
Hi Cognostechie,
I tried your suggestion however I am getting the attached error message.
Title: Re: How to display sales value for previous day in a list report
Post by: clamus17 on 28 Sep 2015 09:22:33 PM
Hi Cognovice!

Upon checking your screenshot, you are applying your condition on a detail filter which will be applied on the whole report not on column Value. Try double clicking the column Value on your list or locate the Value Data Item in the list's query in the query explorer and apply the condition there.
Title: Re: How to display sales value for previous day in a list report
Post by: MFGF on 29 Sep 2015 03:23:14 AM
Quote from: cognovice on 28 Sep 2015 08:24:58 PM
Hi Cognostechie,
I tried your suggestion however I am getting the attached error message.

Hi,

Delete the detail filter you are showing here, drag in a query calculation to your list, and use cogostechie's expression in your query calculation.

MF.
Title: Re: How to display sales value for previous day in a list report
Post by: cognovice on 30 Sep 2015 06:11:17 PM
Hi Clamus17 & MFGF,
Thank you very much for your suggestion.  It worked.  All good.
Title: Re: How to display sales value for previous day in a list report
Post by: cognovice on 30 Sep 2015 08:50:13 PM
Hi All,
I now need to add another column to this report that shows WTD (Week To Date) sales value.  When run on Monday morning, Shows the consolidated value for last week up to Sunday.  When run on Tuesday morning, it shows only Monday's value, when run on Wednesday, it shows Monday and Tuesday Value and so on.

Please help.
Title: Re: How to display sales value for previous day in a list report
Post by: clamus17 on 30 Sep 2015 10:09:26 PM
QuoteHi All,
I now need to add another column to this report that shows WTD (Week To Date) sales value.  When run on Monday morning, Shows the consolidated value for last week up to Sunday.  When run on Tuesday morning, it shows only Monday's value, when run on Wednesday, it shows Monday and Tuesday Value and so on.

Please help.

Hi cognovice,

Can you tell us what have you tried so far? I think there's a lot of date functions that you can apply here. To start with try using  _day_of_week function.

I also attached here a PDF file for common cognos date and time functions. Cheers! :)