Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating the MTD Sales In A Report Page

Status
Not open for further replies.

dfcrj

MIS
Jul 15, 2009
8
US
I tried searching for an answer before I posted but no luck.
I'm extremely new to writing reports but I've been asked to add this into a customer report where the value is displayed whenever they look at the customer details.

I'm trying to determine the MTD sales but I don't know how.
I know how to right it in SQL but I'm not working there anymore so I'm trying to learn cognos.

(Month(TransactionDate) = Month(GetDate()) and Year(TransactionDate) = Year(DateAdd(yy-1, GetDate())

any help would much appreciated on this issue or any advice.
thanks again
 
Code:
CASE WHEN
(extract(Month,TransactionDate) = extract(Month,current_date) and (extract(Year,TransactionDate) = extract(Year,current_date))
Then ([Somemeasure]) else (0) End

Set aggregation to total for this query calculation.

If you only want to fetch MTD as measure, then you can define a filter along similar lines:

Code:
extract(Month,TransactionDate) = extract(Month,current_date) and (extract(Year,TransactionDate) = extract(Year,current_date)

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top