division not working with continuous query in influxdb - influxdb

I am trying to generate a continuous query in influxDB. The query is to fetch the hits per second by doing (1/response time) of the value which i am already getting for another series (say series1).
Here is the query:
select (1000/value) as value from series1 group by time(1s) into api.HPS;
My problem is that the query "select (1000/value) as value from series1 group by time(1s)" works fine and provide me results but as soon as I store the result into continuous query, it starts to give me parse error.
Please help.

Hard to give any concrete advice without the actual parse error returned and perhaps the relevant log lines. Try providing those to the mailing list at influxdb#googlegroups.com or email them to support#influxdb.com.
There's an email on the Google Group that might be relevant, too. https://groups.google.com/d/msgid/influxdb/c99217b3-fdab-4684-b656-a5f5509ed070%40googlegroups.com
Have you tried using whitespace between the values and the operator? E.g. select (1000 / value) AS value....

Related

Unpivoting using QUERY function is not fetching the expected result

I am currently working on a dataset that includes several columns, mostly the dates. What I am trying to achieve is - unpivot all the date columns to use for my subsequent calculations. I use the following formula to unpivot: =ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|"))
Even though this returns the expected result, when I try to nest this within a Query function, it does not work correctly. This is how I applied the formula - QUERY(ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|")),"Select * WHERE Col3 IS NOT NULL")
PS: When I change the data range to say, A2:A100, it gives me the correct result. However, it does not help since lot of new data would get added and I want the formula to be dynamic.
Here's the link to the sample sheet - https://docs.google.com/spreadsheets/d/1dgFY5mT9nUJtFefjAros-XpWXRMFtxEf8Fqrv82N5Ys/edit#gid=1813140523
Any help/suggestions would be highly appreciated
Not sure where you got your SPLIT(FLATTEN technique,
but you have to include both the 3rd and 4th parameters of the split function as FALSE or 0. so in your case it would be:
=ARRAYFORMULA(SPLIT(FLATTEN(Data!A2:A&"|"&Data!D1:AG1&"|"&Data!D2:AG),"|",0,0))
If you do that you'll find your query works.
Also note that the way you have it it's not really working. If you look all the way down in column 1 you'll find a bunch of dates formatted to look like integers.

Totals that fall outside of the query

Newbie to access here.
I'm having an issue that I can't quite get my head around.
I have a very simple db for recording accounting transactions.
It contains, one table for the transactions, one query that returns the transaction amounts between two dates (with a total) and a report that shows the results of the query.
My issue is that I'm trying to add a total for ALL records into the report but I can't figure out how to do it without it just showing the totals from the query.
I've tried referencing the table directly but it returns a name error
I'd like to be able to do this without using VBA or SQL, any help would be most appreciated.
Thanks

Updating a query for false positives

I work in a compliance role at a very small start-up and review a lot of information,for example bank transfers/direct deposits/ACHs every day. A report is pulled from BigQuery,which is exported to Google Sheets.
My question is there are a lot of false positives (basically, "posting data" that repeats often). I'm trying to eliminate it.
One idea, was just to update the query for key words:
WHERE postingdata LIKE 'PersonName%'
But it's tired and time-consuming. And I feel e there's a better way, perhaps 'filtering' the results and then feeding it back to the query. Any ideas or tips or just general thoughts?
In this case you can use group by in your query. This is how you can use this clause.
You can see this code.
SELECT account,TypeTransaction,amount,currency
FROM `tblBankTransaction`
The code returns this data, and some rows are repeated; for example, rows 1 and 7 with the account 894526972455, and it's a deposit.
In this case, I will use the group by clause.
SELECT account,TypeTransaction,amount,currency
FROM `tblBankTransaction`
group by account,TypeTransaction,amount,currency
And it returns this data:
You can see in this example that the account 894526972455 with a deposit only returns 1 row. The same account returns a second row, but is a transfer; it’s a different type of transaction. It depends on the information you have and what column you want to group.
within GS you can try UNIQUE or QUERY with group by aggregation or SORTN with mode 2 as 3rd parameter

getting a count and sum total for the latest date by category in real time

My original data looks like this:
Original Data
I'm looking for a way for my query to return information ONLY for the latest date associated with each Test. For that date, I am looking to get the count number of customers and the $ Paid total. What's complicating my effort is the fact that multiple people could take the Test at a given date and across dates.
The ideal results should look like something like this:
Ideal Results
I am getting information submitted into this table via Google Forms in real-time hence row range will be dynamic & need a solution that can give me the info I am looking for at any given time.
Here is the one that came the closest for me (although still far off as it does not show the Count or the Total $):
=ARRAYFORMULA(VLOOKUP(QUERY({ROW(A2:A),SORT(A2:D)}, "SELECT MAX(Col1) WHERE Col3 IS NOT NULL GROUP BY Col3 LABEL MAX(Col1)''",0),{ROW(A2:A), SORT(A2:D)},{2,3,4,5},0))
Spreadsheet link for Original data and the results of the above query:
Google Spreadsheet with Original Data
I would really appreciate any insights or help from anybody.
Possible solution (based on your document)
https://docs.google.com/spreadsheets/d/1tADqNS4YtdDrMjToCNy2auKB_eNuMdMEA4ahmYJi_3M/edit?usp=sharing
Details:
Lastest date for a test could be found using FILTER MAX functions
Count for a test (at lastest date) could be found using COUNTIFS
Sum for a test (at lastest date) could be found using SUMIFS

InfluxDB how to query every nth value

I am trying to query data every nth element in InfluxDB. I am executing the command below to do so, but I am getting no results. I am using sample data that I created for the sake of the example.
The command I am running in Influx's CLI:
SELECT value FROM generators GROUP BY time(5s)
The result:
GROUP BY requires at least one aggregate function
I am new to InfluxDB, and I am not sure what I am doing wrong. I have read up on making a continuous query, but when I do make one, I am unable to query data as it returns no results. Thank you all to those in advance who reply.
You can use functions like FIRST() or LAST() depending on your requirement.
SELECT FIRST(value) FROM generators GROUP BY time(5s)
https://docs.influxdata.com/influxdb/v1.7/query_language/functions/

Resources