I have fact table which contains data at date level (we have data for oct-2009 to april-2010). Our requirement is to show data of last day of previous month against any day of current month in obiee 11g. I am facing problem in Feb 2010 its picking data of 28-Jan-2010 instead of 31-jan-2010 and for April its picking data of 30-mar-2010 instead of 31-mar -2010.
Any suggestion ???
You're asking to filter your data set to only include rows between:
1) last day of the previous month
2) any day of the current month
This can be achieved with prompting in OBIEE Answers.
last day of previous month = TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) . The problem is you need to make query work within Oracle's Answer syntax.
In the prompt, select the operator type for your date dimension as 'between' and default to 'SQL Results'.
For the 'last day of previous month' , use the query:
case when 1=0 then Time."Fiscal Date" else TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
For the current date, use the query:
case when 1=0 then Time."Fiscal Date" else CURRENT_DATE
Another option is to create a last_date_pervious_month variable in the RPD and have that as the default value in your prompt.