# V2 Query API - Can I filter by column in a custom metric?

**URL:** <https://community.dynatrace.com/t/v2-query-api-can-i-filter-by-column-in-a-custom-metric/36396>\
**Category:** Dynatrace API\
**Tags:** dynatrace-api\
**Created:** [August 31, 2022, 9:26pm UTC](https://community.dynatrace.com/t/v2-query-api-can-i-filter-by-column-in-a-custom-metric/36396 "2022-08-31T21:26:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![louis\_gallo](https://avatars.discourse-cdn.com/v4/letter/l/6f9a4e/32.png) [@louis\_gallo](https://community.dynatrace.com/u/louis_gallo)\
**Post date:** [August 31, 2022, 9:26pm UTC](https://community.dynatrace.com/t/v2-query-api-can-i-filter-by-column-in-a-custom-metric/36396/1 "2022-08-31T21:26:12Z")

</div>

I have a multi-dimension custom metric that returns three dimensions. I would like to just filter and get one particular dimension:

metricId,name,column,host.name,dt.host\_group.id,dt.entity.host,time,value  
custom.mymetric,Foobar,cpulmt,[myserver.example.com](http://myserver.example.com),Linux,HOST-A1FE2C339700D559,2022-08-30 19:47:00,18.200000762939453  
custom.mymetricFoobar,cpupct,[myserver.example.com](http://myserver.example.com),Linux,HOST-A1FE2C339700D559,2022-08-30 19:48:00,81.7  
custom.mymetrixFoobar,iops,[myserver.example.com](http://myserver.example.com),Linux,HOST-A1FE2C339700D559,2022-08-30 19:49:00,2023

What would I add to my V2 API query to just get “cpulmt” column records?

Any help appreciated.

Lou

---

<div class="post-metadata">

**Author:** ![adam\_gardner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/adam_gardner/32/20087_2.png) [@adam\_gardner](https://community.dynatrace.com/u/adam_gardner)\
**Post date:** [August 31, 2022, 11:57pm UTC](https://community.dynatrace.com/t/v2-query-api-can-i-filter-by-column-in-a-custom-metric/36396/2 "2022-08-31T23:57:12Z")

</div>

A few pointers:  
1) Please [read this page](https://www.dynatrace.com/support/help/extend-dynatrace/extend-metrics/reference/metric-ingestion-protocol) to understand the syntax and options.  
2) Why are you pushing infra metrics on something with a host ID? You get that already with the OneAgent?  
2) The time field won’t work as you expect. As per above page it should be timestamp in UTC millis.  
3) Those lines don’t work as they are listed above.

Finally, it looks like you’re trying to add metrics where a OneAgent is already available on that host? If so, why not use [dynatrace\_ingest](https://www.dynatrace.com/support/help/extend-dynatrace/extend-metrics/ingestion-methods/oneagent-pipe) utility instead. Topology relationships happen “automatically”.

If you do actually want to push metrics from outside (via the API) then I’d either suggest 3 separate metrics:

```auto
custom.mymetric.cpulmt,hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 18.200000762939453
custom.mymetric.cpupct,hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 81.7
custom.mymetric.iops,hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 2023

```

 ![adam_gardner_0-1661990003587.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/2576181764ce34405583c8311aff6480eba625f3.png)

OR push a single metric with a new dimension (split & filter):

```auto
custom.mymetric,type="cpulmt",hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 18.200000762939453
custom.mymetric,type="cpupct",hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 81.7
custom.mymetric,type="iops",hostname="myserver.example.com",os="Linux",dt.host_group.id="HOST-A1FE2C339700D559" 2023

```

 ![adam_gardner_1-1661990198220.png](https://global.discourse-cdn.com/dynatrace/original/3X/e/6/e609aef93d09fd1c9be6caa76620d4d9f5b0cdd8.png)

Perhaps you could elaborate on the actual usecase and I can advise the “correct” solution?

---

<div class="post-metadata">

**Author:** ![Ana.Kuzmenchuk](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@Ana.Kuzmenchuk](https://community.dynatrace.com/u/Ana.Kuzmenchuk)\
**Post date:** [December 16, 2022, 8:57am UTC](https://community.dynatrace.com/t/v2-query-api-can-i-filter-by-column-in-a-custom-metric/36396/3 "2022-12-16T08:57:54Z")

</div>

Hi&nbsp;[@louis\_gallo](https://community.dynatrace.com/user/34149)., was the below reply helpful? If not, please share more details so the Community members could help you fully&nbsp;:wink:
