# How to Calculate Number of Days Between Two Dates in Power BI

Problem:

I have a table with customer information, including a target start date of the contract and the actual start date. I would like to add an additional column showing the number of days the contract actually started before (negative number) of after (positive number) the target start date.

Solution1:

You can create a calculated column. Right click on the table, select “New Column”, in the formula section you can use

Column Name = 1. * (Table[actual start date] – Table[target start date])

This should give you a negative number of days between the two dates.

Solution2:

you can create a measure by using a similar formula as solution 1.

Solution3:

You can also use the Dax expression DatesBetween Documentation is found here.

Days Between = DATESBETWEEN( ‘Table'[Dates], ‘Table'[Start Date], ‘Table[End Date] )

This will return a single number for the number of days between the two dates.

Ref: https://community.powerbi.com/t5/Desktop/calculate-number-of-days-between-2-dates/m-p/51213