Wavefront: how get reporting interval in wql? - wavefront

At the picture from Wavefront below I see that at between 11:13 and 11:14 there was one request to my api.
I need to display request per second graph. When I try to use rate() I have the next graph
The request point in the Y axis has value 0.1 but I expect 1 request. And if I change scale the Y value changes as well.
From the rate() doc
rate() finds the per-second rate of change between pairs of adjacent (successively reported) data values, where the later value is greater than the earlier value. The rate of change between a pair of increasing data values is computed as follows: 1. Subtract the earlier data value from the later value. 2. Divide the difference by the number of seconds in the reporting interval.
How can I get the reporting interval in the query to make it show the requests count correctly?

It looks like align() + ratediff() do what I want

Related

Trying to pull Max date less than Date on the row

I know this is a tough one but I'm basically trying to say. Give me a service call and its completion date, then give me the Max date for all service calls where the date is less than the date of the service call I'm inquiring about.
Basically the end result I'm looking for is to say was there another service call on this piece of equipment that was within the last 30 days.
So as you can see in the image for say Asset 50698 service call 579032 we have a date of 11/9/2020 the call below that was 10/22/2020 which was less than 30 days. I want to somehow find a way to count how many service calls I have where this has occurred. Is this possible?
I think you're looking for a context operator In, ForEach or ForAll (in in this case)
Add a variable "MaxAssetDate" and assign it a Formula similar to the following based on your column headers.
=Max([Service Call Completion Date] In ([Asset ID];[Service Call])) In (Asset ID])
Then add this as a column. Provided you have a prompt filtering for a given asset or "date" this column will then show the max date for each service call of the same asset ID. Then add a new variable: ServiceCallDaysDiff: Then by using DatesBetween() with "MaxAssetDate" and ServiceCallCompletionDate and DayPeriod; =DatesBetween([ServiceCallCompletionDate];[MaxAssetDate];DayPeriod) you should get a number 0-X. Then add a filter based if the number is between 1 and 30 then you show those records, otherwise hide the rest; or do whatever logic is then needed.
Now if you're dealing with hundreds of thousands of records this isn't ideal as you're putting all the processing on the webi engine when it ideally would occur as an object in the database layer. However if you only have a few thousand records this should be managable.
To add a count of service calls...
add variable: ServiceCallsCount:
=Sum(Sum(If([ServiceCallDaysDiff]=0;0;1)) In ([AssetID]))
this will count the non zero day differents. Note this will extend beyond 30 so if you want to limit by 30 days adjust the if statement to zero out those not between 1 and 30.
This is but one approach: there may be simpler ways.

Find Row Where Sum is Reached from Single Joined Column (not a range of cells)

I'm trying to run a formula to identify in which row a total sum is reached.
I've been able to do that calculation when I have an entire range of cells to work with, however, I'm doing a filter / join calculation because I need to do this from an individual row with all the data instead of an entire range of cells.
Here is an example google sheet (EDITABLE - feel free) where you can see the range and working formula (both below). Help getting this from the single-cell versions on the top would be very helpful. The error I get with both row() & index() formulas is that the "argument must be a range".
If there's another way to do this besides the single-cell I had that doesn't require referencing the range (e.g. using FILTER) then I'm open to it.
My desired result is to be able to pull the get the second column (date) at the point when the sum is reached (can be via the INDEX & MATCH formula I used or an alternative). This will tell me the earliest date that feeds into the desired sum.
Yes unfortunately you can't do that trick with SUMIFS to get a running total unless the column being totalled is an actual range.
The only approach I know is to multiply successive values by a triangular array like this:
1 0 0 ...
1 1 0 ...
1 1 1 ...
so you get just the sum of the first value, the first 2 values, then 3 values up to n.
This is the formula in F5:
=ArrayFormula(match(E14,mmult(IF(ROW(A1:INDEX(A1:ALL1000,COUNT(split(A5,",")),COUNT(split(A5,","))))>=
COLUMN(A1:INDEX(A1:ALL1000,COUNT(split(A5,",")),COUNT(split(A5,",")))),1,0),TRANSPOSE(SPLIT(A5,",")))))
And the formula in F6 is just
=to_date(INDEX(TRANSPOSE(SPLIT(B5,",")),F5,1))
EDIT
You might have guessed that the above formula was adapted from Excel, where you try to avoid volatile functions like Offset and Indirect.
I have realised since posting this answer that it could be improved in two ways:
(1) By using Offset or Indirect, thus avoiding the need to define a range of arbitrary size like A1:ALL1000
(2) By implying a 2D array by comparing a row and column vector, rather than actually defining a 2D array. This would give you something like this in F5:
=ArrayFormula(match(E14,mmult(IF(ROW(indirect("A1:"&address(COUNT(split(A5,",")),1)))>=
COLUMN(indirect("A1:"&address(1,COUNT(split(A5,","))))),1,0),TRANSPOSE(SPLIT(A5,",")))))
which could be further simplified to:
=ArrayFormula(match(E14,mmult(IF(ROW(indirect("A1:A"&COUNT(split(A5,","))))>=
COLUMN(indirect("A1:"&address(1,COUNT(split(A5,","))))),1,0),TRANSPOSE(SPLIT(A5,",")))))

How to calculate 20% change within one hour in Zabbix?

I have to compare two values changing in both directions (rising and falling) within an hour (items amount, for example). What formula may I use to calculate if the amount drops or rises on more than 20%? Does Zabbix calculated value support if conditions to support positive and negative change or it's possible to bypass it?
I'm trying to write something like this:
{api20prod:mysql.get_active_offers.count(0)}/{api20prod:mysql.get_active_offers.count(,,,1h)}*100 > 20
but what if mysql.get_active_offers.count(0) more than mysql.get_active_offers.count(,,,1h) ?
You cannot use a "Simple Change" preprocessor because:
If the current value is smaller than the previous value, Zabbix
discards that difference (stores nothing) and waits for another value.
If you set the item with a 1h check interval (or with scheduled intervals at a specific minute of every hour), you can do the trick with the last() function.
Let's say that at 12:00 your item equals 25 and at 13:00 it equals 38:
At 13:00 invoking last() without parameters will return 38
At 13:00 invoking last(#2) will return 25
You can calculate the hourly readings delta % with:
100 * ({api20prod:mysql.get_active_offers.last()} - {api20prod:mysql.get_active_offers.last(#2)}) / {api20prod:mysql.get_active_offers.last(#2)}
This syntax should work either in a trigger or in a calculated item, choose the one that suits you better: I suggest a calculated item.
Of course, your trigger will have a double condition: you need to match "> 20" OR "< -20"
If you don't want to change the item's check interval you can use the avg() function, see the documentation.

Google Sheets: Find Row In a Column That Last Had A Larger Value Than The Current Row

Updated: While the solution provided =IF(A2>A1,IF(A2>MAX(A$1:A1),ROW()-1,IFERROR(B1+1,1)),1) does work for the original test data, it doesn't work for a more complex data set, see the second screen shot below:
Original question:
I have a need to process a column (A in the example) of numbers that represents a value changing over time, and establish for how many rows the present row's number has been the largest number, and report that as illustrated in Column B.
What I can't figure out is whether there is a way of producing column B using spreadsheet functions or if I need to write some apps script to do the calculations. I've looked at the usual suspects like MAX() and LARGE() but they don't quite do what I want.
What I want is something like MAXSINCE(A99, A:A98) but that doesn't exist.
Updated data set which still doesn't have an answer for the question: for how many rows has this row had the largest value?
Logic Flow:
Check if current value A2 is greater than previous value A1; If not, return 1
If the above is true, Check whether current value is greater than the present MAX. If so, return current ROW's number - starting offset 1 else add 1 to previous value B1
Code Sample:
B2:
=IF(A2>A1,IF(A2>MAX(A$1:A1),ROW()-1,IFERROR(B1+1,1)),1)
Drag fill down

Time bands in a column in Report Builder 3.0

Take Datetime and give the half hour band it belongs to, irrespective of the date, just interested in the time.
There is as far as I can see, no time periods in SSRS, I need half hour time periods, that's 48 blocks in a day.
I would like to plot my data in bar chart,the interval for the bar width is along the x axis, the height is the occurrences on the y axis. I need an interval of half hour(the width of the histogram),I don't want to run some IIF/CASE statement, I would rather, convert the DateTime i have to a band on each row of data, what's the best way to output so I get half hour intervals along the X axis.
I don't want to run some IIF/CASE statement
By this I assume you mean you don't want 48 layers of IIF/CASE. Here's an SSRS expression that'll band a datetime just using a single IIF:
=DateAdd(DateInterval.Minute, 0-
IIF(Minute(Fields!DATETIMEFIELD.Value) <= 29, Minute(Fields!DATETIMEFIELD.Value), Minute(Fields!DATETIMEFIELD.Value) -30),
DateAdd(DateInterval.Second, 0-Second(Fields!DATETIMEFIELD.Value) ,Fields!DATETIMEFIELD.Value))
This removes the seconds from the time, and removes as many minutes necessary to get to the previous half-hour. You could likely use the same logic with different syntax as a column in your SQL query, if you prefer.
Use this calculated value for all the relevant parts of your SSRS chart.