on 2023 Jun 05 11:15 AM
I would like to set up a time filter that always updates from the 10th of one month to the 10th of the next month. For example, the time window is from May 10th to June 10th. From June 11th, the time filter automatically changes to June 10th to July 10th. How can I achieve this in SAP Analytics Cloud?
1philsul
You can use scripting to achieve it by checking the current date. Few helpful API's
new Date(yyyy,mm,dd) // can be used to create a date
var current_date= new Date(Date.now()); // returns Current Date
var current_day=current_date.getDay(); // returns day of date
var current_month=current_date.getMonth(); // returns current month
var next_month=current_month+1; // returns next month
var current_year=current_date.getYear(); // return current year
// The below can be used to create a time range of days
var day_range=TimeRange.create(TimeRangeGranularity.Day,current_date,new Date(10,next_month,current_year));
The below can be used to set the date filter using the time range created.
Table_1.getDataSource().setDimensionFilter(“Date”, day_range);
Of course you have to check for the year shift in case of December.
Hope this helps you.
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil,
We have a similar requirement. We are trying to apply date range filter on a table, having live connection to Snowflake views using APOS as middleware. I am getting error as unable to initialize dimension filter model.
Any idea whether this timeRange filter wont work for live analytical models? I could not find anything related to this anywhere in help docs.
regards,
Sivakami
I would recommend to do this via Java script with new story or analytics application
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.