How to Calculate a Moving Average by Date | EssentialSQL
May 11, 2024
If you're interested in learning SQL, then why not hop on over and get our course Windows Functions for Business Analytics today at: https://www.udemy.com/course/sql-window-functions-for-business-analytics/?couponCode=BONUS202302
Sample Database and Table At GitHub: https://github.com/kwenzel1/EssentialSQLSamples/tree/master/WinCode
Sample Code:
select SalesDate, Product, Amount,
AVG(Amount) over (partition by Product
order by SalesDate rows between 3 PRECEDING and current row) as FourWeekMovingAvg
from WeeklySales;
I'm here to help, so if you have any questions about the video or there is something I missed that you want to know more of, please let me know.
I'm continually looking for ways to improve what I show you, so I would love to hear your suggestions. Just add them to the comments!
If you're looking to learn more SQL, check out the other courses I've put together. Feel free to use these discount links to get you enrolled today:
• Relational Database Design - SQL Relational Database Design, Data Modeling, and Normalization Explained for MySql, PostgreSQL, and SQL Server @ https://www.udemy.com/course/relational-database-design-sql/?couponCode=BONUS202210
• Stored Procedures Unpacked - Learn to develop, code, & implement stored procedures, transactions, & cursors, in your SQL Server database using T-SQL @ https://www.udemy.com/course/stored-procedures-unpacked-learn-to-code-t-sql-stored-procs/?couponCode=BONUS20221
Show More Show Less #Training & Certification
#Educational Software
#Computer Education
