# How do I use data from another query as a multiplier?

**URL:** <https://community.influxdata.com/t/how-do-i-use-data-from-another-query-as-a-multiplier/20538>\
**Category:** Fluxlang\
**Tags:** grafana, flux\
**Created:** [June 27, 2021, 9:48pm UTC](https://community.influxdata.com/t/how-do-i-use-data-from-another-query-as-a-multiplier/20538 "2021-06-27T21:48:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Covington](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/covington/32/7723_2.png) [@Covington](https://community.influxdata.com/u/Covington)\
**Post date:** [June 27, 2021, 9:48pm UTC](https://community.influxdata.com/t/how-do-i-use-data-from-another-query-as-a-multiplier/20538/1 "2021-06-27T21:48:58Z")

</div>

I have a full query where I am using the constant 1925.25 as a placeholder for what should be a variable (since it is the value of ETH/USD). My current query is this:

```auto
from(bucket: "Mining")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "Miner")
  |> filter(fn: (r) => r["_field"] == "balance")
  |> filter(fn: (r) => r["tag1"] == "ethermine")
  |> map(fn: (r) => ({r with _value: (float(v: r._value) / 1000000000000000000.0) * 1925.25 }))
  |> aggregateWindow(every: 1h, fn: last)
  |> derivative(unit: 1h, nonNegative: true, columns: ["_value"])
  |> cumulativeSum(columns: ["_value"])

```

What I would like to do is use this data variable in place of the 1925.25, but I can’t figure out how to do that:

```auto
data = from(bucket: "Mining")
  |> range(start: -10m)
  |> filter(fn: (r) => r._measurement == "Miner")
  |> filter(fn: (r) => r.tag1 == "flexpool")
  |> filter(fn: (r) => r._field == "price")
  |> last()

data

```

How would I use that in a single query so that I am getting the latest value for “price” for multiplication in the calculation above?

Both of the queries work fine and return what is expecetd in InfluxDB2 Data Explorer (FYI)

Thanks!

---

<div class="post-metadata">

**Author:** ![Covington](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/covington/32/7723_2.png) [@Covington](https://community.influxdata.com/u/Covington)\
**Post date:** [July 28, 2021, 7:50pm UTC](https://community.influxdata.com/t/how-do-i-use-data-from-another-query-as-a-multiplier/20538/2 "2021-07-28T19:50:22Z")

</div>

Still trying to do this and haven’t figured it out ☹ Tried so many things, but keep giving up.

---

<div class="post-metadata">

**Author:** ![FixTestRepeat](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fixtestrepeat/32/5208_2.png) [@FixTestRepeat](https://community.influxdata.com/u/FixTestRepeat)\
**Post date:** [July 28, 2021, 9:16pm UTC](https://community.influxdata.com/t/how-do-i-use-data-from-another-query-as-a-multiplier/20538/3 "2021-07-28T21:16:46Z")

</div>

I’m still learning influxdb2 myself, and there’s some rough edges no doubt.

At a guess, the issue might be that data variable is still a “table” with start /end times and column names, instead of a single value / scalar.

Can you flip the explorer into raw mode (should be a toggle near the run query button) and the paste the output from data variable .
