# Help migrating from InfluxQL to Flux

**URL:** <https://community.influxdata.com/t/help-migrating-from-influxql-to-flux/18980>\
**Category:** Fluxlang\
**Tags:** influxql, upgrade\
**Created:** [March 19, 2021, 10:56am UTC](https://community.influxdata.com/t/help-migrating-from-influxql-to-flux/18980 "2021-03-19T10:56:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Leday](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/nicolas_leday/32/7022_2.png) [@Nicolas\_Leday](https://community.influxdata.com/u/Nicolas_Leday)\
**Post date:** [March 19, 2021, 10:56am UTC](https://community.influxdata.com/t/help-migrating-from-influxql-to-flux/18980/1 "2021-03-19T10:56:02Z")

</div>

Hello,

I’m putting my hands onto Flux query language, while quite used to InfluxQL syntax, and cant’ find a way to translate the following query from InfluxQL to Flux:

SELECT last(“FIELD”)-first(“FIELD”) FROM “measurement” WHERE “some time filter”

Or another similar request:

SELECT last(“FIELD”)-first(“FIELD”) + last(“FIELD2”)-first(“FIELD2”) FROM “measurement” WHERE “some time filter”

Target is (obviously) to get increase in said field(s) value(s) during selected period.

I took a look at flux first() and last() functions, but cannot sort out how to use both of them for calculation. Is it possible?

I am querying from Grafana and InfluxQL works fine for now, but I need to do the same calculation with fields coming from different measurements, which is not possible with InfluxQL.

Thanks in advance for your help!
