Plot time shift line from 4 previous week

Hello

See my viz below:

The shaded blue area is the count of 15 window time shifted 1 week ago

Now I want the average count from 4 previous week.

For example , the April 2 12:15pm:

the green line is the count of 15 min windows (no change)

but the blue line must be the average of :

  • count of 15 min windows for March 26 12:15pm
  • count of 15 min windows for March 19 12:15pm
  • count of 15 min windows for March 12 12:15pm
  • count of 15 min windows for March 5 12:15pm

My Kibana version is 8.15.2. How to do that ?

Regards

Hi!
I think I found a solution. I use a formula like this :

round(
(defaults(count(shift='1w'),0) +
defaults(count(shift='2w'),0) +
defaults(count(shift='3w'),0) +
defaults(count(shift='4w'),0))
/
(ifelse(defaults(count(shift='1w'),-1)< 0,0,1) +
ifelse(defaults(count(shift='2w'),-1)< 0,0,1) +
ifelse(defaults(count(shift='3w'),-1)< 0,0,1) +
ifelse(defaults(count(shift='4w'),-1)< 0,0,1))
)