BusinessObjects Board

Previous quarter object

Hi,

I have one field calld tran_date.

Need to find previous quarter data.pls help me to write sql in Univere level

have tried.

  1. Insert new object called Pre_qtr
    2.In edit properties window i cant go ahead.

ur help is much appriactaed.


BONEW (BOB member since 2004-09-03)

What actually you are trying to do.
Do you want to create a predefined condition using prompt and then get data for the previous quarter for the date passed in the prompt.
Give more details.

.


haider :es: (BOB member since 2005-07-18)

yes u r correct.

when user run the report the report shld give last qtr data( pre qtr).
ex :

01-jan-2008 to 31-03-2008 data

if user user run after 3 months report shld be

01.04.2008 to 31.6.08

hope it clear for you


BONEW (BOB member since 2004-09-03)

There are several functions that will be useful. First, the trunc() function allows you to truncate a date to a specific date component such as quarter, as in

trunc(date, 'Q')

Then to get the previous quarter you can do add_months() with a parameter of -3 to get the start of the prior quarter, and simply subtract one from the date to get the end of the prior quarter.

Then you can use a case statement looking for tran_date between those two values and return the measure or whatever information you are looking for. If you are just looking for the start date and end date of the prior quarter then the functions I have mentioned should be good enough.

These are all Oracle functions. I am assuming you are using Oracle based on your question related to sysdate in another topic.


Dave Rathbun :us: (BOB member since 2002-06-06)