Hi Dagur,
The following document describes some detailed steps on how this can be done.
https://www.ibm.com/support/knowledgecenter/en/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ca_mdlg.doc/t_custom_date_filters.html
If you're interested in doing a rolling 6 months relative to $_as_of_date, which defaults to current_date, then here is an expression that is using the _add_months() macro function.
// This is a template expression that is used by the column property 'Lookup reference'.
// To pass validation, the line below must remain as a comment. Do not remove the forward slashes.
// validate: 1 = 1
#$_this.parent.idForExpression# >=
#timestampMask(_add_months($_as_of_date +' 00:00:00',-6),'yyyy-mm-dd')#
AND
#$_this.parent.idForExpression# <= #$_as_of_date#
_add_months macro function requires a timestamp as input, thus it is a concatenation of $_as_of_date and ' 00:00:00'.
The output is also a timestamp, but only the date portion is needed/wanted, the conversion is done using the macro function timestampMask.
Please let me know if you have any questions.
//Henk
------------------------------
HENK CAZEMIER
------------------------------
Original Message:
Sent: Tue September 17, 2019 04:24 AM
From: Dagur Egonsson
Subject: Relative date
Hi Henk,
I would like to add the relative date filters to the Gregorian calender that comes with CA.
------------------------------
Dagur Egonsson
Original Message:
Sent: Mon September 16, 2019 02:02 PM
From: HENK CAZEMIER
Subject: Relative date
Hi Dagur,I can give you a hand.Are you trying to add a filter to the Caledar definition or is it an ad-hoc instance where you want to do this?The target filter expression would look something like:<some_date_column> between current_date and _add_days(current_date,10)ThanksHenk
Original Message------
Having a hard time to create these relative time filters. Is anyone willing to share the expressions for "Current Date" and "Next 10 Days" (including today)?
------------------------------
Dagur Egonsson
------------------------------
#CognosAnalyticswithWatson