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



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

Answer / 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

More Cognos Interview Questions

What is power prompts?Can somebody explain me.

2 Answers  


---------- Purpose of Factless Facttable?

2 Answers   Bank Of America,


what are the joins present in reportnet?which is most widely used?

2 Answers   IBM, Satyam,


If we run a report, that has 2 pages, i want to display one page in HTML format and another page wil display in pdf format. What is the procedure?

2 Answers   IBM, Polaris,


how can we Upgrad the reports from version Impromptu 6.0 to 7.0 and Power Play from version 6.6 to 7.0 ?

1 Answers  


What is meant by alternate drill down with ex?

1 Answers  


---------------Describe OLAP Reporting and RDBMS Reporting?

1 Answers   Bank Of America,


What is the difference between drill through, drill across?

1 Answers  


what is an sid (surrogate key)?

2 Answers   IBM, Oracle,


Mention the difference between ‘macros’ and ‘prompt’?

1 Answers  


how can create a report like if the salary>50,000 display balance,if salary<50,000 display green?

2 Answers   HCL,


what is query subject

7 Answers   IBM, TCS,


Categories