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
Can you define dimension?
Mention the difference between ‘macros’ and ‘prompt’?
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?
hi friends pls forward impropmtu interview question
Name the types of report?
what are slowly changing dimensions? Why we are used scd?
What are the steps to import the two data sources in framework manager?
Can you define folder?
what is the use of backward drilling in cognos 8?is it possible?whats the uws of it?
What are the roles defined by cognos platform?
write a query to display the departments with no employee?
describe the starschema grouping ?how can i add a new column for existing report ,when it is not present even in model & dataabase?
What is called materialized view?
What are products of cognos?
what is the difference between list report and crosstab report?