How to group events by an event variable/property in Aggregate Series API (Gen2) ?

Alexandre 351 Reputation points
2020-09-04T17:13:04.063+00:00

I am currently investigating on how to migrate my TSI Gen1 queries to TSI Gen2 queries and I can't find how to use the Aggregate Series API of Gen2 to do the same thing I was doing with Aggregate API in Gen 1.

Let's say we have these raw data events in my TSI Gen2

22667-tsi.jpg

I want to aggregate these tarrifId by interval of 1h to know the average consumption by hour.

My query will look like this :

{  
    "aggregateSeries": {  
      "timeSeriesId": [  
        "de1e7bce-c248-44b6-a2c4-f63aa660828f",   
      ],  
      "searchSpan": {  
        "from": "2017-12-31T06:00:00Z",  
        "to": "2017-12-31T10:00:00Z"  
      },  
      "interval": "PT1H",  
      "inlineVariables": {  
        "AverageConsumption": {  
          "kind": "aggregate",  
          "filter": null,  
          "aggregation": {  
            "tsx": "avg($event.consumption.Long)"  
          }  
        }  
      },  
      "projectedVariables": [  
        "AverageConsumption"  
      ]  
    }  
  }  

Now if I want to have this this average consumption by hour for each tariff, I cannot see how to modify my query to do that.
There is nothing than allow me to do a sort compute my averageConsumption "group by" tariffId. One thing to note is that tariffId values are not fixed/static values.

In TSI Gen1 I was able to do this "group by" with nested aggregate / dimension json objects.
Am I missing something or is this not possible anymore ?

Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
401 questions
Azure Time Series Insights
Azure Time Series Insights
An Azure internet of things (IoT) analytics platform to monitor, analyze, and visualize industrial IoT analytics data at scale.
78 questions
{count} votes

Accepted answer
  1. António Sérgio Azevedo 7,671 Reputation points Microsoft Employee
    2020-09-09T15:42:11.097+00:00

    @Alexandre thanks for your patience.

    I have confirmed that this kind of query - computing across ids grouped by some parameter - in Gen1 is what we're calling 'fleet queries' in Gen2. This feature is not available yet, it's something on the roadmap.

    I would suggest that you add it as a feature on UserVoice as well so others can vote for prioritization purposes: https://feedback.azure.com/forums/906859-azure-time-series-insights . If you do so, please share here the link for cross-referencing, I will make sure the feedback is taken into consideration by the team :).

    Finally if you can, please share with us the following to help us better understand your specific scenario:

    • How many sensors will you be aggregating over? on the scale of 10s? 100s?

    Thank you!


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.