Ali Posted January 24, 2020 Share Posted January 24, 2020 Hello, I'm using the aggregate formula and I'm having hard time understanding Startkey() & middlekey(). Endkey() is very clear. I used $s.aggregate(average(),periods(1year,1day),Endkey()) to calculate the yearly rolling avg and time stamp it at the end of each day. I did the same thing for 6 month capsules $s.aggregate(average(),periods(1year,6month),Endkey()) and the end value of both data is equal. When I use middlekey(): $s.aggregate(average(),periods(1year,6month),middlekey()) , I thought Seeq would calculate the middle value of the capsule meaning the last bar value on the graph below would calculate the average of 9/30/2018- 9/30/2019. And for the startkey(), I thought the last bar value represents the beginning of the capsule rolling back 365 days. from 6/30/2018- 6/30/2019. Please advice. Thanks Link to comment Share on other sites More sharing options...
Thorsten Vogt Posted January 24, 2020 Share Posted January 24, 2020 Hi Ali, startKey(), middleKey() and endKey() provide just the timestamp where Seeq will put the calculated value. In your example using periods(1year,6month) Seeq will always calculate the average for one year starting from January (e.g. 01/01/2018 - 01/01/2019) and the average starting from July (e.g. 07/01/2018 - 07/01/2019). For the period 01/01/2018 - 01/01/2019 using - startKey() will put the value to 01/01/2018 - middleKey() will put the value to 07/01/2018 - endKey() will put the value to 01/01/2019 The marked columns in the following Analysis all have the same value for the period of last year : Hope this helps. Regards, Thorsten 2 Link to comment Share on other sites More sharing options...
Ali Posted January 24, 2020 Author Share Posted January 24, 2020 Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now