Unable to use difference percent on stat visualization

I want to use a stat visualization to display the difference in percentage between the first and the last value of an sql result displaying stock data. The query accesses a Mysql db of the finance tool gnucash. In the menu I can only select Difference and get the total difference but cannot select difference percent.

select min(UNIX_TIMESTAMP(date)) as time_sec, sum(value_num/value_denom) as value, fullname as metric
from prices join commodities on prices.commodity_guid = commodities.guid

where  $__timeFilter(date) and quote_source <> 'currency'  
group by date, fullname order by date;

Excerpt of the available grafana calculation list:

Calculation Description
Difference difference between first and last value of a field
Difference percent percentage change between first and last value of a field

What can I do to make Difference percent available? (v. 7.3.6)

Thanks in advance :slight_smile:

1 Like