SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE VIEW [test].[Belege_SKR_STK_F02] AS
SELECT [Periode]
     , [Kostenstelle]
     , [Fabrikat]
     , sum([Ist]) AS [Ist]
FROM (SELECT format([Invoice_Date], 'yyyy-MM') AS [Periode]
           , [Kostenstelle]
           , iif([Kostenstelle] = 'Neuwagen', [Fabrikat], '') AS [Fabrikat]
           , [Ist]
      FROM [transform].[Belege_SKR_STK]
      WHERE [Invoice_Date] >= datefromparts(year(getdate()), 1, 1)) [V1]
GROUP BY [Periode], [Kostenstelle], [Fabrikat]
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
