'How can I calculate Average in Nifi?
How can I calculate the average of an attribute in nifi ? I am using the UpdateAttribute processor. I have 4 attributes that should be added and divide by 4 but how can I perform that in nifi?
Solution 1:[1]
I have assumptions that you have 4 attributes from EvaluateJsonPath processor:
temp
:$.main['temp']
fl
:$.main['feels_like']
tmin
:$.main['temp_min']
tmax
:$.main['temp_max']
Average attribute in UpdateAttribute processor:
average
:${temp:toNumber():plus(${fl:toNumber():plus(${tmin:toNumber():plus(${tmax:toNumber()})})}):divide(4)}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | tonykoval |