# Create Visualization - Get Data for last month

**URL:** https://discuss.elastic.co/t/create-visualization-get-data-for-last-month/261111
**Category:** Kibana
**Tags:** kql-kibana-query-language
**Created:** [January 14, 2021, 10:46am UTC](https://discuss.elastic.co/t/create-visualization-get-data-for-last-month/261111 "2021-01-14T10:46:05Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Marta\_Bondyra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marta_bondyra/32/102122_2.png) [@Marta\_Bondyra](https://discuss.elastic.co/u/Marta_Bondyra)
#### Post date: [January 14, 2021, 11:26am UTC](https://discuss.elastic.co/t/create-visualization-get-data-for-last-month/261111/2 "2021-01-14T11:26:24Z")

</div>

That sounds quite complex. I think the only option is to use Vega, unless someone has better idea?

I’d create two queries – one getting all the user names of all times and the other one only from the last month. Then I’d use a bucket\_selector pipeline aggregation to filter out the values that are in two buckets. If you decide to follow this path, it’d be easier to firstly use dev tools to make sure the data you receive from Elasticsearch looks correct and then move to Vega to create visualization on top of this data. This is not trivial though so you might wanna reconsider ingesting your data in different format to make it easier if it’s possible. Plus if you have a lot of data, this approach is not performant.

Here's a similar example: [Data set difference between fields on different indexes](https://discuss.elastic.co/t/data-set-difference-between-fields-on-different-indexes/160015)

---

_[View the full topic](https://discuss.elastic.co/t/create-visualization-get-data-for-last-month/261111)._
