ASA aggregates

Garrein Bart 1 Reputation point
2020-07-06T15:57:27.253+00:00

Hi,

I have a list of sensor values coming in with some details every 10 seconds. I would like to know (on each entering event=10 seconds) what was the last maximum value of the last 60 values. I can make several blocks like below to output one of the required items.
So I can ask for min(fltValue) as the one item in a block. But for some reason I cannot combine them. Has anyone have encountered this yet?

  1. Why is a combination of max(x)-min(x) not possible? "error CS0426: The type name 'MinMaxState<>' does not exist in the type 'Aggregators'"
  2. How does one pick up the last value from the hopping window for the entries that do not come in every 10 seconds?

DDDdiff AS (
select
System.Timestamp() as processTime,
Source,
Location,
Part,
Description,
-- max(fltValue)- min(fltValue) as rangeOfValue
min(fltValue)
from DDDinfo1
group by source, Location, Part, Description, HoppingWindow(second,600,10)
),

Azure Stream Analytics
Azure Stream Analytics
An Azure real-time analytics service designed for mission-critical workloads.
334 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. HimanshuSinha-msft 19,381 Reputation points Microsoft Employee
    2020-07-07T21:40:46.513+00:00

    Hello @GarreinBart-1885,

    Thanks for the question & also for using the forum .

    I just did a quick test and i am able to do max - min , off course in my case it was all dummy data . So ASA does support aggregate differences . It may be something else which is wrong in the query .

    My query which worked is

     with DDDdiff AS (
     select
     System.Timestamp() as processTime,
     deviceid,
     max(fitvalue) - min(fitvalue) as rangeOfValue
     ,max(fitvalue)
     ,min(fitvalue) 
     from [inputEH]
     group by deviceid, HoppingWindow(second,600,10)
     )
      SELECT * FROM DDDdiff
    

    11555-capture.png

    Thanks Himanshu

    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members


  2. Garrein Bart 1 Reputation point
    2020-08-24T08:35:38.303+00:00

    I stopped using Visual Studio Code. The aggregates worked after i had pivoted the data in a new table per second. But once i have added an extra eventhub as output, the aggregates no longer make a sensible output.

    0 comments No comments