# Need urgent help on below Use case

**URL:** <https://forum.confluent.io/t/need-urgent-help-on-below-use-case/7957>\
**Category:** Lounge\
**Created:** [29 May 2023 21:20 UTC](https://forum.confluent.io/t/need-urgent-help-on-below-use-case/7957 "2023-05-29T21:20:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tushar](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@tushar](https://forum.confluent.io/u/tushar)\
**Post date:** [29 May 2023 21:20 UTC](https://forum.confluent.io/t/need-urgent-help-on-below-use-case/7957/1 "2023-05-29T21:20:26Z")

</div>

Use Case- Travel speed - players moving faster than others or even possibly teleporting.

I have below data.

| Playerid | gameid | Xcoordinate | Ycoordinate | Zcoordinate | Timestamp |
| --- | --- | --- | --- | --- | --- |
| 1 | 100 | 10 | 20 | 30 | 5/11/2023 5:50 |
| 1 | 100 | 10 | 21 | 30 | 5/11/2023 5:53 |
| 1 | 100 | 11 | 20 | 33 | 5/11/2023 5:56 |
| 1 | 100 | 12 | 20 | 30 | 5/11/2023 5:59 |
| 1 | 100 | 12 | 25 | 10 | 5/11/2023 6:02 |
| 1 | 100 | 13 | 20 | 30 | 5/11/2023 6:05 |

Now I want to calculate average moving time from place 1 to place 2.  
Note place is been given in (x,y,z) coordinate.

Is there any way we can calculate above problem?

---

<div class="post-metadata">

**Author:** ![Cerchie](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/cerchie/32/3978_2.png) [@Cerchie](https://forum.confluent.io/u/Cerchie)\
**Post date:** [27 September 2024 15:22 UTC](https://forum.confluent.io/t/need-urgent-help-on-below-use-case/7957/2 "2024-09-27T15:22:19Z")

</div>

Hi @tushar ,

I realize this response may be out-of-date, but I’m assuming you’re using Kafka? We can then use KStreams or Flink for this, but first I’d need to know: this is not a batch of data, correct? This is an average updating in real time that you need?

PS: for anyone else looking at this looking for an example of a moving average with Flink, check out [https://flink-st-kafka.streamlit.app/](https://flink-st-kafka.streamlit.app/).

Here, you can see that this was accomplished using this query:

```auto
INSERT INTO tumble_interval
SELECT symbol, DATE_FORMAT(window_start,'yyyy-MM-dd hh:mm:ss.SSS'), DATE_FORMAT(window_end,'yyyy-MM-dd hh:mm:ss.SSS'), AVG(price)
FROM TABLE(
        TUMBLE(TABLE SPY, DESCRIPTOR($rowtime), INTERVAL '5' SECONDS))
GROUP BY
    symbol,
    window_start,
    window_end;

```
