11. MTD Total

Ғылым және технология

Download the examples from this link: drive.google.com/drive/folder...

Пікірлер: 2

  • @VictorBoney
    @VictorBoneyАй бұрын

    Explanation on how to get the MTD total was really helpful. How can I make it a part of a view so I can call it as and when required. The following is not working for me: CREATE VIEW VW_MonthToDate AS WITH CteMTD as ( SELECT OrderDate,SUM(SalesAmount) TotalSales FROM FactInternetSales GROUP BY OrderDate ) SELECT OrderDate,TotalSales , SUM(TotalSales) OVER(PARTITION BY MONTH(OrderDate) ORDER BY OrderDate) MTDTotal FROM CteMTD order by OrderDate

  • @cloudanddatauniverse

    @cloudanddatauniverse

    Ай бұрын

    Thank you for watching. Yes it is good to convert it into a view, but view cannot have order by clause. Hence remove the orderby clause at the end and convert to view, when you call the view you can add orderby clause