which only works if you also use “This Year” filter at the same time, when designing the report, otherwise the results return the previous month for all years in the database.
I need to create a filter in the universe for previous month, which will take into account the year, so that in January I don’t have the problem of using these two objects “Previous Month” and “This Year” as it won’t work. We want to schedule these reports via BCA and don’t want to have to recreate them in January for this problem.
Please can you give me some feedback as how to go about creating one filter for this, as I keep getting errors.
(As an aside - how come Business Objects dosn’t create this code for us as a standard filter- surely every company uses Date filters??)
I’ve created two dates in the Dates Class - Start of Previous Period and End of Previous Period. I’ve then created a predefined condition for ledger date as per below:
@Select(Ledger Dates\Ledger Date) BETWEEN @Select(Calendar Dates\Start of Previous Period) AND @Select(Calendar Dates\End of Previous Period)
select
cast(convert(char(7),getdate(),23)+'-01' as datetime) -- first day of curr month
, dateadd(d,-1,cast(convert(char(7),getdate(),23)+'-01' as datetime)) -- last day of last month
, dateadd(m, 1,cast(convert(char(7),getdate(),23)+'-01' as datetime)) -- first day of next month
, dateadd(m,-1,cast(convert(char(7),getdate(),23)+'-01' as datetime)) -- first day of last month