BusinessObjects Board

Need the query to get last month start date

Hello All,

I have a requirement that when i open the report i need to see the last month start date and last month end date as default prompt and if needed i can change the date as well.

I am using oracle as my db

I need the variables to be created in the Universe level under parameters.

I created a variable but it is not giving me the result as expected. Can anyone help me out with ready made query. It’s really urgent for me.

Variable what i have used in my parameter is below:-
RelativeDate((RelativeDate(CurrentDate();-1;MonthPeriod)); -(DayNumberOfMonth(CurrentDate())) +1;DayPeriod)

Thanks
test1.jpg


mukesh4255 (BOB member since 2020-03-31)

By doing the month subtraction first, you’re creating a problem when you’re at the end of a month with 31 days.

For today (3/31), your calculation is first getting this day last month (2/29), then subtracting one more than the current day of month (32). So, February 29 minus 32 days.

First day of last month:
RelativeDate(RelativeDate(CurrentDate();1-DayNumberOfMonth(CurrentDate());DayPeriod);-1;MonthPeriod)

or

RelativeDate(Date(Year(CurrentDate());MonthNumberOfYear(CurrentDate());1);-1;MonthPeriod)

Last day of last month:
RelativeDate(CurrentDate();-DayNumberOfMonth(CurrentDate());DayPeriod)


joepeters :us: (BOB member since 2002-08-29)

Hi Joepeters,

I tried your query and i can see that still we are facing same issue. If we go with Feb month we are getting issue. For the Feb month i am getting start date as:- 01/31/2020 and End Date as:- 02/29/2020. Can you please try from your end once and can you please post the screenshot. So that i can discuss with my architect about the issue.

You can try from your end for Jan and Feb, You can see the issue from your end.

Thanks
Mukesh


mukesh4255 (BOB member since 2020-03-31)