kpescatore
MIS
Hi,
I am trying to create a pervious month and 6 months ago filter given a prompted date. My data is stored at the month level, usually as the last day of the month. I know it will work as a transformation within a metric but I need it to be a filter in a custom group.
I tried to use code from the tech note TN5200-7X0-0131. The problem is when I try to include a prompt in it the only one that would work is a value prompt on date, but that will allow the user to select any date and since my data is only stored for 1 day in the month there is too much room for user error. The prompt I would prefer to use is a “Choose from an attribute List” because it will actually select a specific valid date.
The filter is defined as ApplySimple("datepart(Year,dateadd(month,-1,#0))*100+ datepart(month,dateadd(month,-1,#0))",? [Load Date Prompt]) as per the tech note. The filter and the prompt will create the following SQL.
select sum(a11.CURR_UPB) WJXBFS1
from PRS_TBL_LN_PAYMENT a11
join PRS_TBL_LOAD_PERIOD a12
on (a11.LOAD_DATE = a12.LOAD_DATE)
where a12.MONTH_ID = datepart(Year,dateadd(month,-1,a11.LOAD_DATE in ('2004-02-29')))*100+ datepart(month,dateadd(month,-1,a11.LOAD_DATE in ('2004-02-29')))
A11.LOAD_DATE in (‘2004-02-29’) will obviously create an error.
Any help would be appreciated.
Thanks,
Keith
I am trying to create a pervious month and 6 months ago filter given a prompted date. My data is stored at the month level, usually as the last day of the month. I know it will work as a transformation within a metric but I need it to be a filter in a custom group.
I tried to use code from the tech note TN5200-7X0-0131. The problem is when I try to include a prompt in it the only one that would work is a value prompt on date, but that will allow the user to select any date and since my data is only stored for 1 day in the month there is too much room for user error. The prompt I would prefer to use is a “Choose from an attribute List” because it will actually select a specific valid date.
The filter is defined as ApplySimple("datepart(Year,dateadd(month,-1,#0))*100+ datepart(month,dateadd(month,-1,#0))",? [Load Date Prompt]) as per the tech note. The filter and the prompt will create the following SQL.
select sum(a11.CURR_UPB) WJXBFS1
from PRS_TBL_LN_PAYMENT a11
join PRS_TBL_LOAD_PERIOD a12
on (a11.LOAD_DATE = a12.LOAD_DATE)
where a12.MONTH_ID = datepart(Year,dateadd(month,-1,a11.LOAD_DATE in ('2004-02-29')))*100+ datepart(month,dateadd(month,-1,a11.LOAD_DATE in ('2004-02-29')))
A11.LOAD_DATE in (‘2004-02-29’) will obviously create an error.
Any help would be appreciated.
Thanks,
Keith