I’m trying to create a reporting object to be used in my Query Filters so that I can schedule a report dynamically without having to change the dates manually each time. The report is supposed to be able to report data from whole previous month if I run it by this month. For example, a date field which equals to “Previous Month”
I have created an object in Universe with this syntax however it looks it doesn’t seem to work correctly.
CASE WHEN month(dbo.fn_adjusted_date(DATEDIFF(s,'1970-01-01 00:00:00', GETDATE())))=1 THEN 12 ELSE month (dbo.fn_adjusted_date(DATEDIFF(s,'1970-01-01 00:00:00', GETDATE())))-1 END