I have Date,product,Quantity_Sold columns and I want
Product, MTD(month Till date),YTD(Year Till Date) as output.


Can anyone help me with the logic in getting MTD i.e
quantity sold from 1st of this month to till date (i.e. 01-
11-2013 to 26-11-2013) and YTD i.e QTD sold from 1st date
of the year to till date(i.e. 01-01-2013 to 26-11-2013).


Sample output model:

Product MTD YTD

Answer Posted / naresh

HI All,
Follow below steps to achieve this

1) In Filter condition place the below condition (to_char([START_DATE],'YYYY')=to_char({sysdate},'YYYY') and [START_DATE] <= {sysdate})

2)Create one Derived colum as MTD and in Expression use below code

case when (to_char([START_DATE],'MM')=to_char({sysdate},'MM') and [START_DATE] <= {sysdate})
then [Quantiry] end

Next in properties if this column for aggrigate Function and for Rollup Aggrigate Function change 'automatic ' to 'None'.
3) create one more Derived column as YTD and in expression use below code
case when (to_char([START_DATE],'YYYY')=to_char({sysdate},'YYYY') and [START_DATE] <= {sysdate})
then [Quantity] end

here sysdate is oracle date function.

Thats it .

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is model and say about process how to create model and how to test model?

559


What is the diff between cognos 8.1 & cognos 8.2 & cognos 8.3? Measn whet are the enhancements are added in new versions(8.2& 8.3)?

3919


Define catalog in cognos and write its various types?

621


i have one file i saved in csv how can i take these file into framework manager

1541


Explain informatica architecture?

564






how you create security to reports?

605


Can you define a datastore in cognos?

612


It is possible to test 2 query subjects at a time in CRN1.1 & C8 FWM?

1955


What is a Transformer?

653


Source table has 5 rows. Rank in rank transformation is set to 10. How many rows the rank transformation will output?

595


What's the limitation of 'Page Footer' in Report Studio? e.g. If I have an activity prompt (list of activities in a Search & Select Prompt) and selected around 2500 activites from the 'Activity' Search & Select Prompt and when I ran the report I got a message "#! Overflow" in page footer. Can somebody please tell me what's max. limit. I tried with around 300 activities and page footer displayed the activities. Your help will be appriciated.

2152


how you burst the reports? If you are bursted reports is not reached to destination how you identify?when you import data into catalog you have complex columns names.how do you change the name of those columns?

701


What is Bitmap Index?

610


What do you mean by drill across?

580


What is Metrics designer?

597