influxdata / influxdata/influxdb

Getting sum of fields for last three rows

Open
#19,682 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Hello I have table like this

```
time | number | powerActive | powerReactive

2020-10-02T19:14:49.348740556Z | 1 | 62,4836 | -40,5733
2020-10-02T19:14:52.379093435Z | 2 | 24,37138 | -33,6496
2020-10-02T19:14:55.423411364Z | 3 | 661,343 | -243,388
2020-10-02T19:15:20.708042842Z | 1 | 62,42432 | -40,65
2020-10-02T19:15:23.731087527Z | 2 | 24,28768 | -33,6167
2020-10-02T19:15:26.777162548Z | 3 | 661,1625 | -244,849
2020-10-02T19:15:49.21038557Z | 1 | 62,93772 | -40,5812
2020-10-02T19:15:52.255814995Z | 2 | 24,3894 | -33,6072
2020-10-02T19:15:55.294333031Z | 3 | 659,5006 | -245,639
2020-10-02T19:16:21.007985859Z | 1 | 66,84882 | -40,4383
2020-10-02T19:16:24.043319094Z | 2 | 24,24498 | -33,5883
2020-10-02T19:16:27.064539466Z | 3 | 668,6793 | -243,252
```

How to get sum of powerActive and powerReactive for last record (by time) of each digit in column number ?

So in my example I want to get 759,7731 (66,84882+24,24498+668,6793) as sum of powerActive and -317,279 (-40,4383 + -33,5883 + - 243,252) as sum of powerReactive

Contributor guide

Open the contributing guide

Research direction

Start from the example table and determine which InfluxDB query language and version apply; the issue does not provide either. Check whether grouping by number, selecting the latest time for each group, and summing the two fields are supported. Done would be a confirmed query or a clearly documented limitation, with results matching the stated totals.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.