SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE view data.Arbeitstage as
    SELECT [bundeslaender_id],
           [datum],
           [wochentage_id],
           [arbeitstag_mofr],
           [zaehler_mofr],
           [summe_mofr],
           RANK() OVER (
               PARTITION BY bundeslaender_id,
               year(datum),
               arbeitstag_mofr ORDER BY datum
               ) AS [zaehler_jahr_mofr],
           SUM([arbeitstag_mofr]) OVER (
               PARTITION BY bundeslaender_id,
               year(datum)
               ) AS [summe_jahr_mofr],
           [arbeitstag_mosa],
           [zaehler_mosa],
           [summe_mosa],
           RANK() OVER (
               PARTITION BY bundeslaender_id,
               year(datum),
               arbeitstag_mosa ORDER BY datum
               ) AS [zaehler_jahr_mosa],
           SUM([arbeitstag_mosa]) OVER (
               PARTITION BY bundeslaender_id,
               year(datum)
               ) AS [summe_jahr_mosa],
           [feiertage_id]
    FROM [GC_STAGING_LOCOSOFT].[data].[Arbeitstage]
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
