# Ignore weekends in timeline visualization in Kibana 7.10.2

**URL:** <https://discuss.elastic.co/t/ignore-weekends-in-timeline-visualization-in-kibana-7-10-2/333638>\
**Category:** Kibana\
**Created:** [May 17, 2023, 8:59am UTC](https://discuss.elastic.co/t/ignore-weekends-in-timeline-visualization-in-kibana-7-10-2/333638 "2023-05-17T08:59:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priyanka\_Rajpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priyanka_rajpal/32/101287_2.png) [@Priyanka\_Rajpal](https://discuss.elastic.co/u/Priyanka_Rajpal)\
**Post date:** [May 17, 2023, 8:59am UTC](https://discuss.elastic.co/t/ignore-weekends-in-timeline-visualization-in-kibana-7-10-2/333638/1 "2023-05-17T08:59:48Z")

</div>

I have a time series plot on my dashboard, which also includes a mvavg(10) trend line. I want to remove the weekends from the plot and all the calculations(since there is no data available for weekends).  
I tried creating a scripted field(doc['timestamp'].value.getDayOfWeek()) for the same in my index to identify if it's a weekend and use that in a filter, however, the result I get after using that is just a straight line at 0.  
Could someone please suggest a way to ignore weekends ?

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [May 29, 2023, 5:26pm UTC](https://discuss.elastic.co/t/ignore-weekends-in-timeline-visualization-in-kibana-7-10-2/333638/2 "2023-05-29T17:26:13Z")

</div>

You don't specify how you are creating your visualization but with lens this should work.

I've added a scripted field to get if my data point is on a weekend with this script:

```auto
def source = doc['timestamp'].value;

if (source == null){
  emit(false);
  return
}

def day_of_week = source.getDayOfWeek().getValue();
emit(day_of_week > 5)

```

Then created a Lens visualization with an average of a metric and moving average of the same average value

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/643bb0842bdab79ad406e692e3f9dc9903b0d01b.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/d/5d11eddec1541dfb556bbb95e6201d5a359ce768.png)

And now I can filter out the weekend data and I think everything looks OK, right?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/5/559eb6c3b70803bf6dfde8c2b9f518a9a92c1f01.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 26, 2023, 5:26pm UTC](https://discuss.elastic.co/t/ignore-weekends-in-timeline-visualization-in-kibana-7-10-2/333638/3 "2023-06-26T17:26:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
