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
Anonymous
Not applicable

How to subtract the number of days from TODAY() until a specific date

I created a measure called _dateInc that brings me the date when the last product was lost.
I would like to know how many days the stock has been without losing new products, and with that, I would like to subtract TODAY() with the day of the last loss (_dateInc). I tried to use:

measure = TODAY () - [_dateInc]

but I received a strange date, with the year set in 1900. I just want to know the number of days.

1 ACCEPTED SOLUTION
DataZoe
Employee
Employee

@Anonymous Please try 

measure = DATEDIFF([_dateInc],TODAY(),DAY)

https://docs.microsoft.com/en-us/dax/datediff-function-dax 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You can subtract and add Days date without any function.  If you subtract a date from date, it will return diff in term of timestamp

Use date diff if these are two dates

datediff(TODAY () , [_dateInc],DAY)

 

DataZoe
Employee
Employee

@Anonymous Please try 

measure = DATEDIFF([_dateInc],TODAY(),DAY)

https://docs.microsoft.com/en-us/dax/datediff-function-dax 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

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.