Looks like you have created your indicators in the script based on today() or present date. The dynamic identification of last three weeks based on your selection can be achieved using set analysis in the chart expression, something like Sum(Date ={">$(=WeekStart(Max(Date),-3))"}Sales)