Similar to the usecase posted HERE: I’d like to monitor my energy consumption costs, but prices changed since 23-01-01. Depending on the time range selected in Grafana I’d like to query the total energy consumption and multiply it with a given factor. Before 23 it was 50ct, sind 23 it’s 70ct.
The resulting dataset should show how cost increased. This should work with a timerange that spans both years and only one or the other year.
Is the way I approached this within the GitHub issue the best way to go? Or is there some other way I can approach this in a better way?
Personally I would treat the current price on any given day as data, just the
same as the consumption on that day, and store the price in the database along
with the consumption figures.
That makes for a nice flexible solution (especially if you can automate the
acquision of today’s price), including suppliers who change the price of
energy within a day (eg: daytime=expensive, night-time=cheaper).
I do precisely this for telephone billing records, where an X minute call to
destination Y can be priced differently depending on time of day, day of week,
or the current month’s pricelist.