From the Zabbix Manual
the calculated items expression follows the form,
func(<key>|<hostname:key>,<parameter1>,<parameter2>,...)
This is fine for computations using functions over a single item like,
max("temp1",120)
How should a function like min() be applied over 3 different items so it returns the lowest of those?
Unfortunately, that is currently not supported. You may vote on a feature request: https://support.zabbix.com/browse/ZBXNEXT-1829
The answer is in the documentation here http://www.zabbix.com/documentation/2.0/manual/config/items/itemtypes/aggregate
Put the hosts into a group "mygroup" and then:
grpmin["mygroup","temp1",last,0]
If instead, you wanted the minimum of 3 items for the same host, don't do this in an item. Instead put the function in the trigger where you can easily trigger when the min temperature reaches a certain value.
Related
I'm looking to create a variable that will take the take the numeric value for a dimension. I tried removing Nulls in my query details, but that won't work because some results only have a Null value (see screenshot) and I was losing results that way.
I also need the variable for use in a cross tab table so I can do a count of each acuity level. I tried creating a Max variable on the acuity field =Max([Acuity Level]). That works for the main tab, but it doesn't work in a cross tab table. Please see attached screenshots for more details.
Acuity Crosstab
Column: Acuity Level
Row: Tracking Date
=FormatDate([Start Tracking Date & Time];"MM/dd/yyyy")
Body: # of Patients
=Count([Financial Number])
First off I created a query with your test data so I could drop into a free-hand SQL query so I have an example with which I can work. I added Row Number to maintain the row order of your data.
My approach requires three variables. A different approach may be possible requiring less variables or the formulas in the variables could be consolidated. However, I like to keep them separated for better understanding of the logical progression and better maintainability.
Var Acuity Level Adjusted gets set to -1 if the Acuity Level is Null and otherwise leave it as is just to make it easier to deal with...
=If(IsNull([Acuity Level]); -1; [Acuity Level])
Var Max Acuity Level is the greatest value of Var Acuity Level Adjusted within each combination of Patient Name and Encounter Type. This is called a calculation context. I do not understand the nuances of this topic well enough to explain why what I have below works, but it does. I refer to that previous link a lot. Also, this is why it was important that I picked -1 to replace Null.
=Max([Var Acuity Level Adjusted]) In ([Patient Name]; [Encounter Type])
Var Max Filter flags the row where the first two variables are equal. This variable is necessary because you cannot filter based on one object relative to another object.
=If([Var Acuity Level Adjusted] = [Var Max Acuity Level]; 1; 0)
Now if I add those variables it looks like this...
Then we can add a filter to only show the records where Var Max Filter = 1. You can hide the extra columns or even delete them from the table.
Hope you can apply this to your situation.
I am quite new to SSRS and have what I imagine is a pretty simple question. I have the set up pictured below.
What I'm looking for is a list of dates that data exists for then a nested list of outcomes and then how many of each of those outcomes there were on that date. What I get is this,
I want 6/10/2016 > ABORT > to be 3 instead of 1 1 1. What am I doing wrong? Is it possible that I need to change my query somehow?
Try using:
=COUNT(Fields!sys_OUTCOME.Value,"sys_OUTCOME")
If you don't want to see details rows delete the Details group in the Row Groups pane.
Code Explanation:
COUNT: Returns a count of non-null values specified by the expression,
evaluated in the context of the given scope.
REFERENCE
Every aggregation function can summarize data in a given context of the given scope. In this case the scope I passed to the COUNT function is "sys_OUTCOME" group name (Row Groups) so it will return the count of sys_OUTCOME values by sys_OUTCOME group. If you don't specify the group scope it will count every row without grouping what you was getting initially.
Let me know if this helps.
This should be easy, but I am stuck.
I have a table listing some figures about Qualifications - to achieve which a dataset that is essentially a row per Student is being grouped on Qualification with a Parent Grouping on "Measure" (which is just a bucket of qualifications).
One of the columns is trying to work out the number of students (well, more properly the number of students with a value in a particular field, weighted by another field) in each Measure/Qualification. In the screenshot below, it's the "Pred. Avg" column on the right hand side.
So for the Qualification Row Grouping, that column is calculated by:
=CountDistinct(Iif(IsNothing(Fields!AVG_PTS.Value) = False, Fields!Learner_ID.Value, Nothing), "Qual") * Lookup(Fields!Qual_Code.Value, Fields!Qual_Code.Value, Fields!size.Value, "DS_KS5Nationals_LKP")
This works fine - the values of 35 and 11.5 in that rightmost column are correct for those rows. What the top row should be doing is simply adding up the values in the other rows to give me the number of students in this Measure, in this case to give 46.5. To do that the expression I am using is:
=Sum(CountDistinct(Iif(IsNothing(Fields!AVG_PTS.Value) = False, Fields!Learner_ID.Value, Nothing), "Qual") * Lookup(Fields!Qual_Code.Value, Fields!Qual_Code.Value, Fields!size.Value, "DS_KS5Nationals_LKP"), "Measure")
However as you can see in the screenshot, this returns 2917 instead.
So my question is; Why doesn't that work, and given that it doesn't work how can I, within a parent group, aggregate the results of aggregates inside a child group?
EDIT:
OK so, I have determined that the following works correctly:
=Sum(CountDistinct(Iif(IsNothing(Fields!AVG_PTS.Value) = False, Fields!Learner_ID.Value, Nothing), "Qual"), "Measure")
The problem there is that the Qual row that returns 11.5 is weighted to 0.5. I.E. it actually returns 23, and the Lookup(Fields!Qual_Code.Value, Fields!Qual_Code.Value, Fields!size.Value, "DS_KS5Nationals_LKP") is for that row returning 0.5 and altering it to 11.5...so the question becomes; "how do I force that ...*Lookup(Fields!Qual_Code.Value, Fields!Qual_Code.Value, Fields!size.Value, "DS_KS5Nationals_LKP") into the "Qual" scope, like the CountDistinct() is already in?
The issue here is that you're trying to aggregate values using that Lookup function which only returns one value. There are a couple ways you could go about doing this. One option would be to use the LookupSet function to get the applicable weightings. An even better option is to combine the data in your dataset so that the weighting is available without using a lookup. That way the function can recalculate an any grouping level without you having to force a scope on it. Also, CountDistinct ignores "Nothing" so you can do without the extra IIf statement. Hope that helps.
In Zabbix I am trying to show total memory in use as a percentage.
I try and create a calculated item with the formula:
((vm.memory.size[active])/(vm.memory.size[total]))*100
This creates the item, yet when I check it's status it says "Not Supported".
Is there something wrong with calculated item? This is just an example, but I've also had problems with creating calculated items, it always says "Not Supported".
There is a built in item for this vm.memory.size[pused]
Type: Numeric (float)
Units: %
Use custom multiplier: 1
Update interval (in sec): 30
Zabbix Memory Usage in %
For more information check zabbix doc:
https://www.zabbix.com/documentation/3.2/manual/appendix/items/vm.memory.size_params
If you wish to refer to the last values of these items, you should use last() function:
(last(vm.memory.size[active]) / last(vm.memory.size[total])) * 100
Please see Zabbix documentation on calculated items for more details.
I am trying to dynamically format the labels on my SSRS charts based on the underlying value. I'm trying to do this in two scenarios, one to format dates as ordinals and another to choose the appropriate number of decimal places based on actual values present. However, when I use the expression editor with an expression something like this...
=IIF(MAX(ABS(Fields![axisfield].Value))<2, "0.0%","0%")
...the Fields![axisfield].Value is always returning the first value from the dataset, meaning, in this example, if the first value is less than two, the labels will be formatted with one decimal place, even if it is the only one less than two. (So the 'MAX' function is essentially irrelevant.)
That example is attempting to set the overall formatting based on the largest data point in the series, in this next one I'm trying to format each label separately to get Ordinal dates (i.e. 1st, 2nd, etc, and yes, this formula is incomplete: it doesn't need to be to illustrate the problem):
="dd"+IIF(DatePart("d", Fields!date.Value)=1,"\s\t"
,IIF(DatePart("d", Fields!date.Value)=2,"\n\d"
,IIF(DatePart("d", Fields!date.Value)=3,"\r\d"
,"\t\h")))
This will give 1st, 2st, 3st and so on, as the first row in the dataset is for the first.
So, my question is, how do I get round this and, in the first example get the true maximum, and in the second reference the actual value being formatted?
Thanks!
I've had the same issues with using custom functions for setting label visibility. (see my entry for this: How to Display Only 1 Value Label in SSRS 2012 Calculated/Derived Series? )
I believe the issue is that data and fields are bound to the underlying data series but are not bound and accessible within the label itself.
You should be able to set the formatting in the function for the series data itself (as in the 2nd example) and then just set data labels, which will use the underlying series field value. An example with your data might be something like the following, which returns the values with the format:
="dd"+IIF(DatePart("d", Fields!date.Value)=1,Format(Fields!date.Value, "\s\t")
,IIF(DatePart("d", Fields!date.Value)=2,Format(Fields!date.Value,"\n\d")
,IIF(DatePart("d", Fields!date.Value)=3,Format(Fields!date.Value, "\r\d")
,Format(Fields!date.Value,"\t\h"))))
In the first example, you can get the max value to referring to the Dataset, as opposed to the field. Your code would then be:
=IIF(ABS(MAX(Fields![axisfield].Value, "YourDatasetName"))<2, "0.0%","0%")
(I changed the order of operations for Abs and Max because you have to use an aggregate function when referring to the whole dataset. Only then can you refer to the specific value.)