Hi Team,
How can I create column B such that column B shows the product of consecutive values of column A please?
cc: @scott , @Anaisdg , @grant1 tagging for attention please
Hi Team,
How can I create column B such that column B shows the product of consecutive values of column A please?
cc: @scott , @Anaisdg , @grant1 tagging for attention please
Hey Scott, @scott , any idea on the above please?
Hello @ajetsharwin,
Thank you for your question and sorry for the delay. Sometimes we donât get to questions over the weekend.
If your data is stored at regular intervals and youâre wanting to use Flux then you could:
If your data isnât at regular intervals or you fail to record a value there isnât a way to achieve this with Flux.
Iâd recommend using a client library. Maybe Python and using Pandas.
Hey Anais,
Given the roadmap of Influx 3 and Flux, Iâm getting back to use InfluxQL for queries.
With respect to CUMULATIVE PRODUCT, we can calculate this by taking the exponential of the cumulative sum.
Iâm trying to implement the below InfluxQL query which calculates the cumulative product but am facing the mixing aggregate and non-aggregate queries is not supported influxql error
, could you please advise on how to best tackle this?
Query:
SELECT EXP(CUMULATIVE_SUM(qty_pct_change_ln)) as quantity_change, quantity
FROM âquantity_managementâ.âgroup-productsâ
WHERE time > now()-7h and product_id = âABCâ
GROUP BY product_id
cc: perhaps @Jay_Clifford or @scott can help too
@ajetsharwin Itâs because youâre not applying any functions to the quantity field, so InfluxQL doesnât know what to do with it. If you remove quantity
from the SELECT
statement, it should work.
SELECT EXP(CUMULATIVE_SUM(qty_pct_change_ln)) as quantity_change
FROM âquantity_managementâ.âgroup-productsâ
WHERE time > now()-7h and product_id = âABCâ
GROUP BY product_id
I know this probably isnât ideal, but itâs one of the quirks of InfluxQL. Really, neither EXP
or CUMULATIVE_SUM
should be considered an aggregate function since they donât reduce the number of rows returned by the query. This might be an InfluxQL bug.
Thanks @scott, is there anyway in which I can query both quantity and quantity change in the same query? or do they have to be queried using two queries?
Can you please advise where I can best raise this bug?
I think, currently, theyâd have to be queried with two separate queries. Probably the best place to report the bug would be on the InfluxDB repo.