cancel
Showing results for 
Search instead for 
Did you mean: 

Time Filter SAC

0 Kudos

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?

Accepted Solutions (0)

Answers (2)

Answers (2)

N1kh1l
Active Contributor
0 Kudos

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

sivakami_plr
Explorer
0 Kudos

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

William_Yu
Product and Topic Expert
Product and Topic Expert
0 Kudos

I would recommend to do this via Java script with new story or analytics application