Forum Discussion
Anonymous
6 years agoNot applicable
Average basis hour duration from timestamp
Hi All I have data with timestamp like below with single instance for each hour of day/date and i want to calculate average value for last 40 hours for each instance/hour. Any helps will be appre...
- 6 years ago
Took me longer than I would like to admit 😛 Anyway, I solved it, by creating a calculated column with the following formula:
Last48Hours = AVERAGEX(FILTER(Table1, Table1[Timestamp] <= EARLIER(Table1[Timestamp]) && Table1[Timestamp] > EARLIER(Table1[Timestamp])-40/24), Table1[Value])The reason it took me longer than I expected was both 'how to add hours to a datetime' and also the double filter. Anyway, this will result in the following table:
This was fun, hope it helped 🙂
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Kudo's are welcome 🙂
dax
6 years agoCommunity Support
Hi dynamic2019,
You could try to refer to my sample to see whether it work or not.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.