# Convert a query Flux to PromQL

**URL:** <https://discuss.prometheus.io/t/convert-a-query-flux-to-promql/1601>\
**Category:** PromQL\
**Created:** [April 17, 2023, 9:27am UTC](https://discuss.prometheus.io/t/convert-a-query-flux-to-promql/1601 "2023-04-17T09:27:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Livio](https://avatars.discourse-cdn.com/v4/letter/l/f07891/32.png) [@Livio](https://discuss.prometheus.io/u/Livio)\
**Post date:** [April 17, 2023, 9:27am UTC](https://discuss.prometheus.io/t/convert-a-query-flux-to-promql/1601/1 "2023-04-17T09:27:05Z")

</div>

I have a request that I’m having difficulty converting from Flux to PromQL. I have two identical databases, one in InfluxDB and the other in Prometheus. Currently, I am trying to see if I can transfer all of my queries to PromQL. I have some queries where I can’t find the solution, and I hope you can help me.

Here is my query in Flux:

```plaintext
from(bucket: "showroom")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["deviceType"] == "TIC")
  |> filter(fn: (r) => r["_field"] == "EAP_s")
  |> map(fn: (r) => ({ _value:float(v: r._value) * 365.0 * 3.4 / 4.0, _time:r._time, _field:r.device_id + "/" + r.PTCOUR1}))
  |> aggregateWindow(every: 1d, fn: spread, createEmpty: false)
  |> group(columns: ["_time"])
  |> sum()
  |> group(columns: ["table"])
  |> mean()
  |> map(fn: (r) => ({ Class: r._value}))

```

This part in Flux corresponds to the metric “TIC\_EAP\_s” in Prometheus:

```plaintext
from(bucket: "showroom")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["deviceType"] == "TIC")
  |> filter(fn: (r) => r["_field"] == "EAP_s")

```
