SELECT
        SUM(OrderQty)           OVER(PARTITION BY BY Field1, Field2)                    AS Total 
        ,AVG(OrderQty)          OVER(PARTITION BY BY Field1, Field2)                    AS "Avg" 
        ,COUNT(OrderQty)        OVER(PARTITION BY BY Field1, Field2)                    AS "Count" 
        ,MIN(OrderQty)          OVER(PARTITION BY BY Field1, Field2)                    AS "Min" 
        ,MAX(OrderQty)          OVER(PARTITION BY BY Field1, Field2)                    AS "Max" 
        ,LEAD (SalesYTD, 1, 0)  OVER (PARTITION BY Field1, Field2 ORDER BY Clause)      AS "Latência"
        ,LAG (SalesYTD, 1, 0)   OVER (PARTITION BY Field1, Field2 ORDER BY Clause)      AS "Defazagem"
        ,RANK ( )               OVER ( PARTITION BY Field1, Field2  ORDER BY Clause)    AS "RANK"
        ,RANK_DENSE ( )         OVER ( PARTITION BY Field1, Field2  ORDER BY Clause)    AS "RANK_DENSE"
        ,ROW_NUMBER( )          OVER(PARTITION BY Field1, Field2  ORDER BY Clause)      AS "Index"
        ,NTILE(4)               OVER(ORDER BY SalesYTD DESC)                            AS "QUARTIL"

FROM DataBase

 

 

 

Para Outras funções ****íticas:  Funções ****íticas (Transact-SQL) | Microsoft Docs