Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I am wishing to get the sum of sales for the last 6 complete weeks. Given that today's date is 24th Aug 2023, I wish to get from 10th July to 20th August.
Next week I wish the calc to go from 17th July to 27th Aug.
I am using the following
Sum({<[Date]={"$(= '>=' & WeekStart(Date(Today() - 43)) & '<=' & WeekStart(Date(Today()-7)))"}>}Sales).
However, when I look at daily data it sums from 10th July to Monday 14th Aug.
Hi Digvijay, thanks for introducing me to the WeekEnd function.
I have used it to get
Sum({<[Date]={"$(= '>=' & WeekStart(Date(Today() - 43)) & '<=' & WeekEnd(Date(Today()-7)))"}>}Sales)
and my table shows the last 6 weeks results and when I test it works.
Thanks again.
I think you should use 2nd parameter of Weekstart to get the desired results.
I have not tested it but use something like below -
Sum({<[Date]={"$(= '>=' & WeekStart(Date(Today(), - 7)) & '<=' & WeekEnd(Date(Today(),-1)))"}>}Sales)
Check after testing if -7 or -6 is the correct week you need to go backward to
Hi Digvijay, thanks for introducing me to the WeekEnd function.
I have used it to get
Sum({<[Date]={"$(= '>=' & WeekStart(Date(Today() - 43)) & '<=' & WeekEnd(Date(Today()-7)))"}>}Sales)
and my table shows the last 6 weeks results and when I test it works.
Thanks again.
But I still feel you should use 2nd parameter in Weekstart/end instead of subtracting days.