Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PaulCo
Helper II
Helper II

Adding a column which calculates the number of days between a date in a column and today's date

I would like to create a column in a table which contains the number of days between a the date in a column and today's date. 

 

For instance I would like it to look like this if todays date was 6/20/2017

 

Estimated Close DateDays until Close
6/30/201710
6/29/20179

 

 

I tried using the add custom column with the TODAY() function but it wasn't being recognised. 

 

Does anyone know the most efficient way to show the number of days?

 

Thanks

 

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @PaulCo,

 

You should also be able to use TODAY() function to create calculate column to your table like below. Smiley Happy

Days until Close = Table1[Estimated Close Date] - TODAY()

c4.PNG

 

Note: just replace 'Table1' with your real table name, and set the Data type to Whole Number for the new created calculate column.

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Employee
Employee

Hi @PaulCo,

 

You should also be able to use TODAY() function to create calculate column to your table like below. Smiley Happy

Days until Close = Table1[Estimated Close Date] - TODAY()

c4.PNG

 

Note: just replace 'Table1' with your real table name, and set the Data type to Whole Number for the new created calculate column.

 

Regards

This worked thanks Smiley Very Happy

Mi2n
Employee
Employee

Today() is a DAX function. You cannot use it in the Power Query part where you create a custom column. You will have to use the M language in this case.

 

Duration.Days(Duration.From(<Date field name> - DateTime.LocalNow))

Try something like this. You might have to replace the <Date field name> with your corresponding field name.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.