COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: cognovice on 12 Oct 2015 10:49:41 PM

Title: How to display Quantity column as a sum for Year To Date
Post by: cognovice on 12 Oct 2015 10:49:41 PM
Hi,
In a list report, I want to display the "Quantity" column as a sum for Year To Date (Add quantity from start of year and up until today).  Can I get some assistance here please...
Title: Re: How to display Quantity column as a sum for Year To Date
Post by: BigChris on 13 Oct 2015 02:03:46 AM
Depends what you're trying to get to really (it's not very clear from your question). If you want an additional column for the YTD amount you'll need a calculation that looks something like:

if ( [DateField] between _make_timestamp(year(current_date),1,1) and current_date) then ([AmountField]) else (0)

If you just want to filter the report and total the field at the bottom then you'll want a filter on the report that's similar:

[DateField] between _make_timestamp(year(current_date),1,1) and current_date