Sql-server – Split value from a date range in to individual values per date

sql serverssrs

I am modifying a SSRS sales report for my customer. I have already calculated the number of days and based on that the daily value. In the software you set the start and end date of the agreement which are visible on the report.

My customer wants to split the agreement value in to individual date values. Is there a way how I can split the date range in to individual dates? Then I would just group all the individual dates values from all agreements in to one daily total.

I am using SQL Server 2017 and Visual Studio 2013

enter image description here

Best Answer

WITH cte AS ( SELECT {columns list}, start_date as single_date 
              FROM source_table
            UNION ALL
              SELECT {columns list}, DATEADD(day, 1, single_date)
              FROM cte
              WHERE single_date  < finish_date )
SELECT *
FROM cte;

Example fiddle