# Transform / Filter issue in Area chart

**URL:** <https://discuss.elastic.co/t/transform-filter-issue-in-area-chart/175444>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [April 4, 2019, 2:56pm UTC](https://discuss.elastic.co/t/transform-filter-issue-in-area-chart/175444 "2019-04-04T14:56:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 4, 2019, 2:56pm UTC](https://discuss.elastic.co/t/transform-filter-issue-in-area-chart/175444/1 "2019-04-04T14:56:44Z")

</div>

Here is part of my "data" section:  
"data": [  
{  
"name": "sp500",  
url: {  
index: mgpnlquery\*  
body: {  
size: 1000  
\_source: ["price", "account", "acctype", "region"]  
"query": {  
"range" : {  
"@timestamp" : {  
"gte" : "now-34s",  
"lt" : "now"  
}  
}  
}  
}  
}  
"format": { "property": "hits.hits" }  
},  
{  
"name": "noFilter",  
"source": "sp500",  
"transform": [  
{"type": "filter", "expr": "datum.region != null"}  
]  
},  
etc .....

The following works to display the data: ("sp500" is the datastream)  
"marks": [  
{  
"type": "group",  
"name": "detail",  
"encode": {  
"enter": {  
"height": {"value": 390},  
"width": {"value": 1700}  
}  
},  
"scales": [  
{  
"name": "xDetail",  
"type": "point",  
"range": "width",  
"domain": {"data": "sp500", "field": "\_source.account"}  
"domainRaw": {"signal": "detailDomain"}  
},  
{  
"name": "yDetail",  
"type": "linear",  
"range": [390, 0],  
"domain": {"data": "sp500", "field": "\_source.price"},  
"nice": true, "zero": true  
}  
],  
.. etc

The following does not work ("noFilter" is the datastream) - Am I configuring "noFilter" incorrectly?  
"marks": [  
{  
"type": "group",  
"name": "detail",  
"encode": {  
"enter": {  
"height": {"value": 390},  
"width": {"value": 1700}  
}  
},  
"scales": [  
{  
"name": "xDetail",  
"type": "point",  
"range": "width",  
"domain": {"data": "noFilter", "field": "\_source.account"}  
"domainRaw": {"signal": "detailDomain"}  
},  
{  
"name": "yDetail",  
"type": "linear",  
"range": [390, 0],  
"domain": {"data": "noFilter", "field": "\_source.price"},  
"nice": true, "zero": true  
}  
],  
.. etc

---

<div class="post-metadata">

**Author:** ![mgolubov55](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mgolubov55](https://discuss.elastic.co/u/mgolubov55)\
**Post date:** [April 4, 2019, 6:21pm UTC](https://discuss.elastic.co/t/transform-filter-issue-in-area-chart/175444/2 "2019-04-04T18:21:07Z")

</div>

Problem solved - the correct syntax for the filter:  
{  
"name": "noFilter",  
"source": "sp500",  
"transform": [  
{"type": "filter", "expr": "datum.\_source['region'] != null"}  
]  
},

---

<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:** [May 2, 2019, 6:21pm UTC](https://discuss.elastic.co/t/transform-filter-issue-in-area-chart/175444/3 "2019-05-02T18:21:07Z")

</div>

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