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 Slicer memberset?

1 Answers  


How can you schedule the report that it displays a day old data. (My answer was to create a view, but the lady wanted some other method).

1 Answers  


How to create a dynamic column name in Cognos?

6 Answers   Aditya Birla, Polaris,


what is the automation tool used for data warehouse testing???

3 Answers   Covansys, IBM, Wipro,


What is Cognos Mashup Services .what is the use of Cognos Mashup Services and where to use.

1 Answers  






In my Report C-id c-name Revenue are the query items I need to display the report has Alternative colors for rows and Revenue >=1000 has display in another color? i.e Both c-id,c-name are applying the alternative color(red,yellow) condition and revenue (blue) u think..How its possible? Iam doing for alternative colors i defined Two dataitems as running-count and Mod... and next in Boolean varaible define as [Query1].[Data Item2] = 1 or 0 and [Query1].[Revenue]>=1000 as like this (it's correct or not) and define in condition explorer yes and no purpose two colors(here how to define 4 revenue color) By selecting the list columns body style its applying only the Body and run report it working only for alternative colors Next i defined by using same Boolean condition for revenue like this. For selecting only the Revenue Body and define as yes 4 one color and no for another color? But here it the revenue column also applying only the alternative color condition and it's taking the >=1000 condition... So,i need to display 2 columns have alternative colors and 3rd column >=1000 cell have another color any body pls give me the replay/answer in step wise..... Thank u Basha

0 Answers   TCS,


How to Reset Pagenumbers in one report.

0 Answers  


can any one pls send me the project flow at the time of interview

0 Answers  


suppose i want to do drill through a column only for the values which is having more than > 50000. how can i do that?

2 Answers   Mind Tree,


My report output is showing data as 1 11 111 2 22 222 3 33 333 How can I sort this to 1 2 3 11 22 33 111 222 333

1 Answers  


Hi All, I have 1.6 years of experience in cognos in India. I always wanted to do a MS program to earn some money in US. But I think I am little late in taking the decision. As If I have to write my GRE it will be August or September of 2012 and will have to apply for fall 2013 as fall 2012 admissions are almost done now. So my concern is how will be my career do if my MS is at this stage,. i,.e. 3 years experience in Cognos and 2 years MS program in and again looking for job in U.S. Have I been too late in taking the call? I heard that MIS (Managing Information Systems) is having very good placements now. So guys, please advice me in taking the decision to have a good career and also in terms of earning money as I have few financial problems to solve (which I am hoping to solve when I get job in US after completion of my MS program). Thanks a lot friends. I really appreciate and thank one and all for their valuable comments in this site.

0 Answers  


Can you define metrics designer?

0 Answers  


Categories