beck_bakytbek
Master
2023-09-21
12:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Avg of last 3 Months
Hi Folks,
i have a question / issue:
my Data do look like:
TimePeriod | Plant | Account | Value | Avg of last 3 Month |
2023 01 | 1 | 4500 | 100 | 0 |
2023 02 | 1 | 4500 | 200 | 0 |
2023 03 | 1 | 4500 | 300 | 0,5 |
2023 04 | 1 | 4500 | 400 | 0,4444 |
2025 05 | 1 | 4500 | 500 | 0,4167 |
2023 01 | 2 | 4500 | 50 | 0 |
2023 02 | 2 | 4500 | 60 | 0 |
2023 03 | 2 | 4500 | 70 | 0,3888 |
2023 04 | 2 | 4500 | 80 | 0,3809 |
2025 05 | 2 | 4500 | 90 | 0,375 |
my issue is: how can i calculate the avg of last 3 Months in script (i can solve it with expression, i already need calculated results, but this is only possible in the script).
i have tried to solve it with previous () like:
(Value + Previous(Value)+Previous(Previous(Value))/3 as Avg_of_3_LastMonth
but no correct results come up
Does anyone know how to solve it in the script?
Thanks a lot for your time and your help
Bek
377 Views
1 Reply
anat
Master
2023-09-21
04:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rangeavg(Peek(value), Peek(value, -2), Peek(value, -3)) as Result
359 Views