Please help me to create following statistic - I need to count daily user registrations and output percentage of difference between current day and the average of 4 the previous weekdays.
So I’m trying to create task to downsample data first, like this:
How to do the export of data? When I run this query I’m getting 30 rows too (from bucket “Test”), but running task with that query returns just one row (“d” bucket)
It would be very useful for me to see some data example with similar use case (like user registration) and sample of downsampling task for another bucket where I can see number of registration per day
Okey, looks like I’ve found the problem - I have to add _measurement, _field fields to new bucket to make it work… But another problem - the daily count now is duplicated every time task is launched. Is it possible to update daily count every 10minutes for example and don’t create new record each time?
Hello @aksonov ,
Without some example input and output data and your flux query I’m afraid I can’t do much to help you. Can you please share your input data and expected output data and your flux queries?
Thanks
Hello @aksonov,
So the line protocol you shared is the output of the task?
Can you please share your input data from(bucket: “Test”)
Can you try and use last() before the to() function?
I had to set _measurement because otherwise it says “_measurement” field is not found. Have you run that query by yourself? I tried to use last(column: “daily_count”) but it says “daily_count field is not found”. Could you give me exact query?
I would love to give you the exact query, but I’m having some trouble with the data you gave me. Yes I was able to run it by myself, but since you didn’t provide timestamps I had to write my own timestamps. I made the assumption that all of the data you gave me occurred in one day. And it works for me. Only one value is returned with the query you returned. So I can use the to() function to write one data point to any bucket of my choosing.
please note that the count is = 5 because I only wrote a subset of your data from id = 1 to id = 5. as I felt it was sufficient to try and understand your problem.
Can you please provide me with timestamps for your data? Or alternatively use the export to CSV button to export your raw input data to CSV so I can try it for myself?
Communicating data transformations can be hard! Thanks for sticking with me.
Thank you for your answer! Looks like here is some misunderstanding. That query really returns one row. But the task with that query inserts that row every time it runs. But I need something like “UPDATE” SQL, not “INSERT”. I need just to have ONE record per day (when task is executed every 5m to have actual data). Maybe I don’t understand Flux query language well…