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

how u will design the report if the objects are available

2325


What do you understand by the term 'model durability'?

570


Re: hi,dis is Hari.I'm searhing on cognos.1 want realtime scenarios with solutions.persons having hands on experience in real time plz help me out. my mail-id is shankerhari17@yahoo.com, hope u will respond as soon as possible. thank u in advance

1665


what is the difference between list report and crosstab report?

713


What is the metric store database?

538






my table having data like this year month revenue 2011 jan 100 2011 feb 200 2011 mar 150 like this i want My report 2011 jan 100 2011 feb 100+200=300 2011 mar 300+150=450 like this for this where we specify the condition how will specify? pls ans me pls...

3512


What is cognos reporting tool?

613


Write types of folders present in cognos?

570


I have two queries in first query i have to show all values,in second query i have to show 3 values and want to hide 3 values what prompt ur going to use, why that prompt

1827


----------------Diff b/w Dimensional modeling and Relational modeling?

13912


Which lifecycle we will use for reporting?

565


1. We have been asked to add summary information to sales reprasentatives performance report. The report needs to be grouped by country and city to compare performance between areas Also we need to include revenue totals for each city and each country.

1769


If we are migrating lower version of Cognos reports (e.g. from Ver 7.0 to Cognos 8) then how we migrate Impromptu Catalog (ver 7.0) in Cognos 8? Do we create FM model for that? Please explain.

1706


what are all the versions of cognos and cognos8 as well as mention all the advantages nd disadvantages in cognos8 versions. any one plz answer this question.

2030


Define query studio?

595