Given two dates, how can I calculate the number of days between them?


To calculate the difference between two date fields (such as a project's Start and End date so you can find out the duration of the project in days, for example) you can use the DATEDIFF expression to create a new calculated field. You can choose to count this "difference" in Day, Month, Year units if needed.

DATEDIFF(Day, [CammsInsightsDemo].[dbo].[Project_ProjectRegister_STND].[StartDate], [CammsInsightsDemo].[dbo].[Project_ProjectRegister_STND].[Completion Date])

Don't forget to set your resulting Data Type to "Numeric" as shown in the screenshot below.

Note: When using the above sample expressions, don't forget to replace the yellow highlighted fields above with your own fields.Â