Calculate mean value between two dates - filter

I'm trying to calculate the mean temperature between two dates in different ID groups. In this case, would I calculate the mean temperature from the first bud to the first opening bud, and then the mean temperature from the first opening bud to the first flower in all ID groups.
I have calculated the date for the first flowering event in R. Used this R-code:
your textgrowth <- df1 %>%
group_by(CameraID) %>%
filter(!duplicated(Vekst))`
enter image description here
I think that I have to go back to df1 to calculate the mean temperature from the first event to the next event.
Used this R-code to calculate the mean temperature. But do not know to add r-codes that calculate mean temperature between the first bud to the first opening bud, and then the mean temperature from the first opening bud to the first flower and so on for each group.
test <- dft%>% group_by(CameraID,Vekst) %>% summarize(temp_mean=mean(T2_mean,na.rm=T))%>% filter(!duplicated(Vekst))

Related

How to subtract cell value if adjacent cell has specific text?

I have a spreadsheet of all my personal budgeting, and I've allocated different amounts to different categories (e.g. power bills, cars etc.) I want to have a cell that shows how much is remaining in each individual category.
For example, say I have 1000 allocated for power bills per year. I want a cell that has the formula of something along the lines of:
=1000-IFS(F2="Power",E2)
Where column F is the category of bill in text, and column E is the amount each bill was.
I want it this formula to apply for the whole column, instead of me needing to enter in each individual cell with conditions. Can someone help please?
I have tried:
=1000-IFS(F:F="Power",E:E)
But this only comes up with error messages.
try in row 1:
=INDEX(1000-IF(F:F="Power", E:E, ))

Qlikview: Problem of the average duration of the most used subscription modality

Be a subscription video streaming service. There are 3 subscription modalities, A, B, C. You want to calculate the average duration of the modality that has the highest number of subscribers per month.
The next chart show the amount of users by the type of suscription modality.
I need the expresion to generate a chart that shows the duration of the mode with the highest number of users per month.
I have the following fictitious data:
If you are using Month as a dimension on a chart, you can use the expression:
=FirstSortedValue(
Aggr(Avg(Duration), Msuscription, Month),
-Aggr(Count(user), Msuscription, Month)
)
This is sorting by the expression you used to create the chart in your question, and using - returns the highest value.

Google Sheets Countdown Timer for Aircraft Flight Plan "Time Remaining"

I'm struggling with a formula in Google Sheets that will display a countdown for how much time remains until an aircraft is overdue, based on a filed flight plan.
What I have: 2 key pieces of information about a flight plan:
how much estimated time it will take to make the flight (ETE:
Estimated Time Enroute)
what time the aircraft departed (ATA: Actual Time of Departure)
Constraints: (mandated by company policy)
The ETE must be entered in decimal format, in numbers of hours. A 1hr 30min flight must have an ETE of 1.5, or a 20 minute flight must have an ETE of .3 (rounded to the nearest 10th).
The ATA must be entered in 4-digit 24hr time, but without the colon. 1:30pm must be entered as "1330"
The countdown timer must be displayed in minutes, rounded to the nearest whole number. 1hr 28min must be listed "88"
The countdown should be "live" (this is solved by spreadsheet settings to update "on update or every minute".
The countdown should easily indicate aircraft that have become "overdue" (this will be solved with conditional formatting to highlight negative numbers)
My pseudo formula is essentially just: Now() - (ETE+ATD), but I'm stuck on how to get around the constraints, specifically the three different time formats (decimal hours ETE, 4-digit 24hr time ATA, and remaining time in minutes).
I've set up a dummy sheet here:
https://docs.google.com/spreadsheets/d/165mXKRquI4aBEEap8PIHVrFpAraaapykGqjkDg22qeU/edit?usp=sharing
*I've looked through this Q&A, but it's a GAS solution. I'd much prefer to just have a formula. Preferably an array formula, so that it copies down to however many rows there might end up being.
**Possibly a secondary concern down the road: at the moment, we do not conduct overnight flights, but it's possible in the future. Starting a 3hr flight at 10pm will result in the arrival time being the next day. Hopefully, there is a solution for this.
I suggest some testing before use, but should be worth trying:
=if(now()>today()+1*(left(A2,2)&":"&right(A2,2)),round(24*60*(today()+1*(left(A2,2)&":"&right(A2,2))-now())+B2*60,0),"")
where the ATA value is in A2 and the ETE in B2.
Could be simplified but longer might be easier to adapt for overnight, if required.

Display count for a day using counter metrics in data dog

We have a counter metric in one our micro services which pushes data to DataDog. I want to display the total count for given time frame, and also the count per day (X axis would have the date and Y axis would have count). How do we achive this?
I tried using sum by and diff with Query value representation. It gives the total number of the count for given time frame. But I would like to get a bar graph with the X axis as the date and the Y axis as the count. Is this possible in DataDog?
It seems like there are 2 main questions here:
display the total count for a given time frame.
the count per day.
I think the rollup method is going to be your friend for both questions.
For #1 you need to pass in the time frame you want a total over: sum:<metric_name>.rollup(sum, <time_frame>) and the single value can be displayed using the Query Value visualization.
For #2 the datadog docs say you can get metrics per a day by
graphed using a day-long rollup with .rollup(avg,86400)
So this would look something like sum:<metric_name>.rollup(sum, 86400) and can be displayed a Timeseries with bars.

How to create timeline chart with average using Kibana?

I am ingesting data to elasticsearch using flume, I want to create a time-series graph in kibana to show the events collected over time. BUT I also want to to the average per that time unit so the user knows if the current flow is around the average or not.
To create a timeline I am using line graph with #timestamp as X-axis and count as Y-axis.
The question is how to create the average line? and how to make this average dynamic e.g. as we zoom in average changes from average per day to average per hour.
While creating a visualization you can choose the type of y-axis metric. The default is "count". You can click on the icon to choose other type of metrics you want. It will have various options like average, sum, percentile etc.
As for the time range of average calculation, the the x-axis metrics, under buckets when you choose date histogram the default interval is auto.This means that the time range of average will chage automatically depending on overall time range selected.
You can change it to a fixed interval like per second, minute, hourly daily etc.
It's a bit odd, you would expect count to appear alongside field as something you can average. In reality you have to do it another way:
For the Y axis, instead of selecting count, select "Average Bucket"
then set up your bucket aggregation that you would like e.g. Date Histogram with second interval.
Below this you have another box for metric, e.g. the thing you're averaging, set this to count

Resources